OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / doc / postgresql / html / tutorial-sql.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >The SQL Language</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
9 REV="MADE"
10 HREF="mailto:pgsql-docs@postgresql.org"><LINK
11 REL="HOME"
12 TITLE="PostgreSQL 7.4.1 Documentation"
13 HREF="index.html"><LINK
14 REL="UP"
15 TITLE="Tutorial"
16 HREF="tutorial.html"><LINK
17 REL="PREVIOUS"
18 TITLE="Accessing a Database"
19 HREF="tutorial-accessdb.html"><LINK
20 REL="NEXT"
21 TITLE="Concepts"
22 HREF="tutorial-concepts.html"><LINK
23 REL="STYLESHEET"
24 TYPE="text/css"
25 HREF="stylesheet.css"><META
26 NAME="creation"
27 CONTENT="2003-12-22T03:48:47"></HEAD
28 ><BODY
29 CLASS="CHAPTER"
30 ><DIV
31 CLASS="NAVHEADER"
32 ><TABLE
33 SUMMARY="Header navigation table"
34 WIDTH="100%"
35 BORDER="0"
36 CELLPADDING="0"
37 CELLSPACING="0"
38 ><TR
39 ><TH
40 COLSPAN="5"
41 ALIGN="center"
42 VALIGN="bottom"
43 >PostgreSQL 7.4.1 Documentation</TH
44 ></TR
45 ><TR
46 ><TD
47 WIDTH="10%"
48 ALIGN="left"
49 VALIGN="top"
50 ><A
51 HREF="tutorial-accessdb.html"
52 ACCESSKEY="P"
53 >Prev</A
54 ></TD
55 ><TD
56 WIDTH="10%"
57 ALIGN="left"
58 VALIGN="top"
59 ><A
60 HREF="tutorial-start.html"
61 >Fast Backward</A
62 ></TD
63 ><TD
64 WIDTH="60%"
65 ALIGN="center"
66 VALIGN="bottom"
67 ></TD
68 ><TD
69 WIDTH="10%"
70 ALIGN="right"
71 VALIGN="top"
72 ><A
73 HREF="tutorial-advanced.html"
74 >Fast Forward</A
75 ></TD
76 ><TD
77 WIDTH="10%"
78 ALIGN="right"
79 VALIGN="top"
80 ><A
81 HREF="tutorial-concepts.html"
82 ACCESSKEY="N"
83 >Next</A
84 ></TD
85 ></TR
86 ></TABLE
87 ><HR
88 ALIGN="LEFT"
89 WIDTH="100%"></DIV
90 ><DIV
91 CLASS="CHAPTER"
92 ><H1
93 ><A
94 NAME="TUTORIAL-SQL"
95 ></A
96 >Chapter 2. The <ACRONYM
97 CLASS="ACRONYM"
98 >SQL</ACRONYM
99 > Language</H1
100 ><DIV
101 CLASS="TOC"
102 ><DL
103 ><DT
104 ><B
105 >Table of Contents</B
106 ></DT
107 ><DT
108 >2.1. <A
109 HREF="tutorial-sql.html#TUTORIAL-SQL-INTRO"
110 >Introduction</A
111 ></DT
112 ><DT
113 >2.2. <A
114 HREF="tutorial-concepts.html"
115 >Concepts</A
116 ></DT
117 ><DT
118 >2.3. <A
119 HREF="tutorial-table.html"
120 >Creating a New Table</A
121 ></DT
122 ><DT
123 >2.4. <A
124 HREF="tutorial-populate.html"
125 >Populating a Table With Rows</A
126 ></DT
127 ><DT
128 >2.5. <A
129 HREF="tutorial-select.html"
130 >Querying a Table</A
131 ></DT
132 ><DT
133 >2.6. <A
134 HREF="tutorial-join.html"
135 >Joins Between Tables</A
136 ></DT
137 ><DT
138 >2.7. <A
139 HREF="tutorial-agg.html"
140 >Aggregate Functions</A
141 ></DT
142 ><DT
143 >2.8. <A
144 HREF="tutorial-update.html"
145 >Updates</A
146 ></DT
147 ><DT
148 >2.9. <A
149 HREF="tutorial-delete.html"
150 >Deletions</A
151 ></DT
152 ></DL
153 ></DIV
154 ><DIV
155 CLASS="SECT1"
156 ><H1
157 CLASS="SECT1"
158 ><A
159 NAME="TUTORIAL-SQL-INTRO"
160 >2.1. Introduction</A
161 ></H1
162 ><P
163 >    This chapter provides an overview of how to use
164     <ACRONYM
165 CLASS="ACRONYM"
166 >SQL</ACRONYM
167 > to perform simple operations.  This
168     tutorial is only intended to give you an introduction and is in no
169     way a complete tutorial on <ACRONYM
170 CLASS="ACRONYM"
171 >SQL</ACRONYM
172 >.  Numerous books
173     have been written on <ACRONYM
174 CLASS="ACRONYM"
175 >SQL</ACRONYM
176 >, including <A
177 HREF="biblio.html#MELT93"
178 ><I
179 >Understanding the New <ACRONYM
180 CLASS="ACRONYM"
181 >SQL</ACRONYM
182 ></I
183 ></A
184 > and <A
185 HREF="biblio.html#DATE97"
186 ><I
187 >A Guide to the <ACRONYM
188 CLASS="ACRONYM"
189 >SQL</ACRONYM
190 > Standard</I
191 ></A
192 >.
193     You should be aware that some <SPAN
194 CLASS="PRODUCTNAME"
195 >PostgreSQL</SPAN
196 >
197     language features are extensions to the standard.
198    </P
199 ><P
200 >    In the examples that follow, we assume that you have created a
201     database named <TT
202 CLASS="LITERAL"
203 >mydb</TT
204 >, as described in the previous
205     chapter, and have started <SPAN
206 CLASS="APPLICATION"
207 >psql</SPAN
208 >.
209    </P
210 ><P
211 >    Examples in this manual can also be found in the
212     <SPAN
213 CLASS="PRODUCTNAME"
214 >PostgreSQL</SPAN
215 > source distribution
216     in the directory <TT
217 CLASS="FILENAME"
218 >src/tutorial/</TT
219 >.  Refer to the
220     <TT
221 CLASS="FILENAME"
222 >README</TT
223 > file in that directory for how to use
224     them.  To start the tutorial, do the following:
225
226 </P><PRE
227 CLASS="SCREEN"
228 ><SAMP
229 CLASS="PROMPT"
230 >$</SAMP
231 > <KBD
232 CLASS="USERINPUT"
233 >cd <VAR
234 CLASS="REPLACEABLE"
235 >....</VAR
236 >/src/tutorial</KBD
237 >
238 <SAMP
239 CLASS="PROMPT"
240 >$</SAMP
241 > <KBD
242 CLASS="USERINPUT"
243 >psql -s mydb</KBD
244 >
245 <SAMP
246 CLASS="COMPUTEROUTPUT"
247 >...</SAMP
248 >
249
250 <SAMP
251 CLASS="PROMPT"
252 >mydb=&gt;</SAMP
253 > <KBD
254 CLASS="USERINPUT"
255 >\i basics.sql</KBD
256 ></PRE
257 ><P>
258
259     The <TT
260 CLASS="LITERAL"
261 >\i</TT
262 > command reads in commands from the
263     specified file. The <TT
264 CLASS="LITERAL"
265 >-s</TT
266 > option puts you in
267     single step mode which pauses before sending each statement to the
268     server.  The commands used in this section are in the file
269     <TT
270 CLASS="FILENAME"
271 >basics.sql</TT
272 >.
273    </P
274 ></DIV
275 ></DIV
276 ><DIV
277 CLASS="NAVFOOTER"
278 ><HR
279 ALIGN="LEFT"
280 WIDTH="100%"><TABLE
281 SUMMARY="Footer navigation table"
282 WIDTH="100%"
283 BORDER="0"
284 CELLPADDING="0"
285 CELLSPACING="0"
286 ><TR
287 ><TD
288 WIDTH="33%"
289 ALIGN="left"
290 VALIGN="top"
291 ><A
292 HREF="tutorial-accessdb.html"
293 ACCESSKEY="P"
294 >Prev</A
295 ></TD
296 ><TD
297 WIDTH="34%"
298 ALIGN="center"
299 VALIGN="top"
300 ><A
301 HREF="index.html"
302 ACCESSKEY="H"
303 >Home</A
304 ></TD
305 ><TD
306 WIDTH="33%"
307 ALIGN="right"
308 VALIGN="top"
309 ><A
310 HREF="tutorial-concepts.html"
311 ACCESSKEY="N"
312 >Next</A
313 ></TD
314 ></TR
315 ><TR
316 ><TD
317 WIDTH="33%"
318 ALIGN="left"
319 VALIGN="top"
320 >Accessing a Database</TD
321 ><TD
322 WIDTH="34%"
323 ALIGN="center"
324 VALIGN="top"
325 ><A
326 HREF="tutorial.html"
327 ACCESSKEY="U"
328 >Up</A
329 ></TD
330 ><TD
331 WIDTH="33%"
332 ALIGN="right"
333 VALIGN="top"
334 >Concepts</TD
335 ></TR
336 ></TABLE
337 ></DIV
338 ></BODY
339 ></HTML
340 >