亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch02.htm

?? Learn SQL in an easy way...
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD>		<TITLE>Teach Yourself SQL in 21 Days, Second Edition -- Day 2 -- Introduction to the Query: The SELECT Statement</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><CENTER><H1><IMG SRC="../buttonart/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM" BORDER="0"><BR><FONT COLOR="#000077">Teach Yourself SQL in 21 Days, Second Edition</FONT></H1></CENTER><CENTER><P><A HREF="../ch01/ch01.htm"><IMG SRC="../buttonart/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch03/ch03.htm"><IMGSRC="../buttonart/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../buttonart/contents.gif" WIDTH="128"HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <HR></CENTER><CENTER><H1><FONT COLOR="#000077">- Day 2 -<BR>Introduction to the Query: The <TT>SELECT</TT> Statement</FONT></H1></CENTER><H2><FONT COLOR="#000077">Objectives</FONT></H2><P>Welcome to Day 2! By the end of the day you will be able to do the following:<UL>	<LI>Write an SQL query	<P>	<LI>Select and list all rows and columns from a table	<P>	<LI>Select and list selected columns from a table	<P>	<LI>Select and list columns from multiple tables</UL><H2><FONT COLOR="#000077">Background</FONT></H2><P>To fully use the power of a relational database as described briefly on Day 1,&quot;Introduction to SQL,&quot; you need to communicate with it. The ultimate communicationwould be to turn to your computer and say, in a clear, distinct voice, &quot;Showme all the left-handed, brown-eyed bean counters who have worked for this companyfor at least 10 years.&quot; A few of you may already be doing so (talking to yourcomputer, not listing bean counters). Everyone else needs a more conventional wayof retrieving information from the database. You can make this vital link throughSQL's middle name, &quot;Query.&quot;</P><P>As mentioned on Day 1, the name Query is really a misnomer in this context. AnSQL query is not necessarily a question to the database. It can be a command to doone of the following:<UL>	<LI>Build or delete a table	<P>	<LI>Insert, modify, or delete rows or fields	<P>	<LI>Search several tables for specific information and return the results in a specific	order	<P>	<LI>Modify security information</UL><P>A query can also be a simple question to the database. To use this powerful tool,you need to learn how to write an SQL query.<H2><FONT COLOR="#000077">General Rules of Syntax</FONT></H2><P>As you will find, syntax in SQL is quite flexible, although there are rules tofollow as in any programming language. A simple query illustrates the basic syntaxof an SQL select statement. Pay close attention to the case, spacing, and logicalseparation of the components of each query by SQL keywords.</P><PRE><FONT COLOR="#0066FF"><B>SELECT NAME, STARTTERM, ENDTERMFROM PRESIDENTSWHERE NAME = 'LINCOLN';</B></FONT></PRE><P>In this example everything is capitalized, but it doesn't have to be. The precedingquery would work just as well if it were written like this:</P><PRE><FONT COLOR="#0066FF"><B>select name, startterm, endtermfrom presidentswhere name = 'LINCOLN';</B></FONT></PRE><P>Notice that <TT>LINCOLN</TT> appears in capital letters in both examples. Althoughactual SQL statements are not case sensitive, references to data in a database are.For instance, many companies store their data in uppercase. In the preceding example,assume that the column <TT>name</TT> stores its contents in uppercase. Therefore,a query searching for 'Lincoln' in the <TT>name</TT> column would not find any datato return. Check your implementation and/or company policies for any case requirements.<BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Commands in SQL are not case sensitive.	<HR></BLOCKQUOTE><P>Take another look at the sample query. Is there something magical in the spacing?Again the answer is no. The following code would work as well:</P><PRE><FONT COLOR="#0066FF"><B>select name, startterm, endterm from presidents where name = 'LINCOLN';</B></FONT></PRE><P>However, some regard for spacing and capitalization makes your statements mucheasier to read. It also makes your statements much easier to maintain when they becomea part of your project.</P><P>Another important feature of ; (semicolon)semicolon (;)the sample query is thesemicolon at the end of the expression. This punctuation mark tells the command-lineSQL program that your query is complete.</P><P>If the magic isn't in the capitalization or the format, then just which elementsare important? The answer is keywords, or the words in SQL that are reserved as apart of syntax. (Depending on the SQL statement, a keyword can be either a mandatoryelement of the statement or optional.) The keywords in the current example are<UL>	<LI><TT>SELECT</TT>	<P>	<LI><TT>FROM</TT>	<P>	<LI><TT>WHERE</TT></UL><P>Check the table of contents to see some of the SQL keywords you will learn andon what days.<H2><FONT COLOR="#000077">The Building Blocks of Data Retrieval: SELECT and FROM</FONT></H2><P>As your experience with SQL grows, you will notice that you are typing the words<TT>SELECT</TT> and <TT>FROM</TT> more than any other words in the SQL vocabulary.They aren't as glamorous as <TT>CREATE</TT> or as ruthless as <TT>DROP</TT>, butthey are indispensable to any conversation you hope to have with the computer concerningdata retrieval. And isn't data retrieval the reason that you entered mountains ofinformation into your very expensive database in the first place?</P><P>This discussion starts with <TT>SELECT</TT> because most of your statements willalso start with <TT>SELECT</TT>:</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">SELECT &lt;COLUMN NAMES&gt;</FONT></PRE><P>The commands, see also statementsbasic <TT>SELECT</TT> statement couldn't be simpler.However, <TT>SELECT</TT> does not work alone. If you typed just <TT>SELECT</TT> intoyour system, you might get the following response:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT;</B></FONT></PRE><H5><FONT COLOR="#000000">OUTPUT:</FONT></H5><PRE><FONT COLOR="#000000"></FONT></PRE><PRE><FONT COLOR="#0066FF">SELECT     *ERROR at line 1:ORA-00936: missing expression</FONT></PRE><P>The asterisk under the offending line indicates where Oracle7 thinks the offenseoccurred. The error message tells you that something is missing. That something isthe <TT>FROM</TT> clause:</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">FROM &lt;TABLE&gt;</FONT></PRE><P>Together, the statements <TT>SELECT</TT> and <TT>FROM</TT> begin to unlock thepower behind your database.<BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>keywordsclausesAt this point you	may be wondering what the difference is between a keyword, a statement, and a clause.	SQL keywords refer to individual SQL elements, such as <TT>SELECT</TT> and <TT>FROM</TT>.	A clause is a part of an SQL statement; for example, <TT>SELECT </TT>column1, column2,	... is a clause. SQL clauses combine to form a complete SQL statement. For example,	you can combine a <TT>SELECT</TT> clause and a <TT>FROM</TT> clause to write an SQL	statement. <HR></P>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Each implementation of SQL has a	unique way of indicating errors. Microsoft Query, for example, says it can't show	the query, leaving you to find the problem. Borland's Interbase pops up a dialog	box with the error. Personal Oracle7, the engine used in the preceding example, gives	you an error number (so you can look up the detailed explanation in your manuals)	and a short explanation of the problem. <HR></BLOCKQUOTE><H2><FONT COLOR="#000077">Examples</FONT></H2><P>Before going any further, look at the sample database that is the basis for thefollowing examples. This database illustrates the basic functions of <TT>SELECT</TT>and <TT>FROM</TT>. In the real world you would use the techniques described on Day8, &quot;Manipulating Data,&quot; to build this database, but for the purpose ofdescribing how to use <TT>SELECT</TT> and <TT>FROM</TT>, assume it already exists.This example uses the <TT>CHECKS</TT> table to retrieve information about checksthat an individual has written.</P><P>The <TT>CHECKS</TT> table:</P><PRE><FONT COLOR="#0066FF">   CHECK# PAYEE                   AMOUNT REMARKS--------- --------------------    ------ ---------------------        1 Ma Bell                    150 Have sons next time        2 Reading R.R.            245.34 Train to Chicago        3 Ma Bell                 200.32 Cellular Phone        4 Local Utilities             98 Gas        5 Joes Stale $ Dent          150 Groceries        6 Cash                        25 Wild Night Out        7 Joans Gas                 25.1 Gas</FONT></PRE><H2><FONT COLOR="#000077">Your First Query</FONT></H2><H5><FONT COLOR="#000000">INPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>select * from checks;</B></FONT></PRE><H5><FONT COLOR="#000000">OUTPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">queriesCHECK# PAYEE                   AMOUNT REMARKS ------ --------------------   ------- ---------------------</FONT></PRE><PRE><FONT COLOR="#0066FF">     1 Ma Bell                    150 Have sons next time     2 Reading R.R.            245.34 Train to Chicago     3 Ma Bell                 200.32 Cellular Phone     4 Local Utilities             98 Gas     5 Joes Stale $ Dent          150 Groceries     6 Cash                        25 Wild Night Out     7 Joans Gas                 25.1 Gas7 rows selected.</FONT></PRE><H5>ANALYSIS:</H5><P>This output looks just like the code in the example. Notice that columns 1 and3 in the output statement are right-justified and that columns 2 and 4 are left-justified.This format follows the alignment convention in which numeric data types are right-justifiedand character data types are left-justified. Data types are discussed on Day 9, &quot;Creatingand Maintaining Tables.&quot;</P><P>The asterisk (<TT>*</TT>) in <TT>select *</TT> tells the database to return allthe columns associated with the given table described in the <TT>FROM</TT> clause.The database determines the order in which to return the columns.<H3><FONT COLOR="#000077">Terminating an SQL Statement</FONT></H3><P>In some implementations of SQL, the semicolon at the end of the statement tellsthe interpreter that you are finished writing the query. For example, Oracle's SQL*PLUSwon't execute the query until it finds a semicolon (or a slash). On the other hand,some implementations of SQL do not use the semicolon as a terminator. For example,Microsoft Query and Borland's ISQL don't require a terminator, because your queryis typed in an edit box and executed when you push a button.<H3><FONT COLOR="#000077">Changing the Order of the Columns</FONT></H3><P>The preceding example of an SQL statement used the <TT>*</TT> to select all columnsfrom a table, the order of their appearance in the output being determined by thedatabase. To specify the order of the columns, you could type something like:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT payee, remarks, amount, check# from checks;</B></FONT></PRE><P>Notice that each column name is listed in the <TT>SELECT</TT> clause. The orderin which the columns are listed is the order in which they will appear in the output.Notice both the commas that separate the column names and the space between the finalcolumn name and the subsequent clause (in this case <TT>FROM</TT>). The output would

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品沙发午睡系列990531| 成人免费视频国产在线观看| 欧美自拍偷拍一区| 亚洲小说春色综合另类电影| 欧美性三三影院| 日韩电影免费一区| 欧美成人福利视频| 国产成人福利片| ●精品国产综合乱码久久久久| 在线观看欧美日本| 美女国产一区二区| 中文字幕av资源一区| 91色在线porny| 香蕉加勒比综合久久| 精品国产sm最大网站免费看| 成人综合在线观看| 一区二区高清在线| 精品福利视频一区二区三区| 福利视频网站一区二区三区| 亚洲一区日韩精品中文字幕| 精品免费国产一区二区三区四区| 国产sm精品调教视频网站| 亚洲狠狠丁香婷婷综合久久久| 欧美精品18+| 国产成人高清在线| 午夜国产精品一区| 国产视频在线观看一区二区三区| 一本久久精品一区二区| 免费国产亚洲视频| 日韩精品成人一区二区在线| 亚洲精品一区二区三区精华液| 成人激情电影免费在线观看| 亚洲va天堂va国产va久| 国产欧美日韩不卡免费| 欧美一级在线免费| 91啪九色porn原创视频在线观看| 久久精品国产成人一区二区三区 | 中文字幕日韩一区二区| 欧美精品xxxxbbbb| 波多野结衣亚洲| 久久99精品久久久| 天天操天天综合网| 亚洲欧洲无码一区二区三区| 欧美videos大乳护士334| 欧洲精品在线观看| 丰满白嫩尤物一区二区| 久久国产精品72免费观看| 亚洲最大成人网4388xx| 欧美激情一区在线观看| 91精品国产综合久久久蜜臀粉嫩| 一本高清dvd不卡在线观看| 国产美女久久久久| 久久精品国产一区二区三| 亚洲综合一区二区三区| 国产精品久久久久一区| 久久久久久一二三区| 日韩无一区二区| 欧美日韩综合一区| 色婷婷精品久久二区二区蜜臀av| 国产大陆精品国产| 国产一区不卡在线| 精品午夜久久福利影院| 日本伊人精品一区二区三区观看方式 | 欧美人伦禁忌dvd放荡欲情| k8久久久一区二区三区| 懂色av一区二区夜夜嗨| 国产成人在线网站| 国产在线麻豆精品观看| 蜜臀av一区二区三区| 婷婷亚洲久悠悠色悠在线播放| 亚洲精品ww久久久久久p站| 国产精品高潮呻吟| 国产精品久久久久久久久免费樱桃| 久久一日本道色综合| 久久理论电影网| 久久精品人人爽人人爽| 国产亚洲综合性久久久影院| 久久亚洲精华国产精华液| 精品国产区一区| 精品国产免费视频| 久久先锋影音av鲁色资源网| 久久综合九色综合久久久精品综合| 日韩三级中文字幕| 精品sm在线观看| 久久精品一级爱片| 国产精品午夜在线观看| 国产精品久久久久一区二区三区| 中文字幕在线观看一区| 亚洲另类在线制服丝袜| 亚洲午夜国产一区99re久久| 午夜影院久久久| 美女视频一区二区| 韩国精品一区二区| 成人激情综合网站| 91成人在线精品| 欧美一区二区精美| 久久久国产精品午夜一区ai换脸| 国产精品午夜在线观看| 一区二区三区在线视频观看 | 国产精品蜜臀在线观看| 亚洲视频在线观看三级| 亚洲一区精品在线| 久久国产尿小便嘘嘘尿| 国产精品一区二区免费不卡 | 国产香蕉久久精品综合网| 久久综合色8888| 欧美天堂一区二区三区| 欧美一级视频精品观看| 欧美性大战xxxxx久久久| 日韩一级在线观看| 久久久国产午夜精品| 日韩毛片在线免费观看| 日本欧美一区二区| 国产成人精品www牛牛影视| 欧美性受极品xxxx喷水| 精品国产一区二区在线观看| 亚洲视频免费在线| 久久成人精品无人区| jizz一区二区| 日韩视频一区二区三区| 欧美性生交片4| 国产成+人+日韩+欧美+亚洲| 国产在线精品不卡| 色综合激情久久| 日韩免费视频一区| 亚洲三级免费电影| 另类人妖一区二区av| 日本韩国欧美在线| 精品国产乱码久久久久久影片| 亚洲男人的天堂一区二区| 久久99精品久久久久婷婷| 欧美在线免费观看亚洲| 久久午夜老司机| 亚洲超碰97人人做人人爱| 国产不卡在线播放| 91精品国产91久久综合桃花| √…a在线天堂一区| 黄一区二区三区| 欧美日韩一区 二区 三区 久久精品 | 亚洲永久精品大片| 成人小视频在线| 精品电影一区二区| 亚洲成a人在线观看| 99久久精品免费| 国产日韩欧美综合在线| 蜜桃av一区二区三区电影| 欧美私人免费视频| 亚洲色图制服诱惑 | 高清在线成人网| 91精品国产综合久久国产大片| 亚洲视频一区二区在线观看| 国产999精品久久| 精品日韩成人av| 蜜桃av噜噜一区| 在线综合亚洲欧美在线视频| 一级中文字幕一区二区| 91在线视频网址| 国产精品免费观看视频| 国产成人av电影在线| 亚洲视频免费看| 粉嫩一区二区三区性色av| 久久久综合九色合综国产精品| 美女视频第一区二区三区免费观看网站| 欧美视频一区二区三区在线观看 | 久久蜜桃av一区二区天堂| 麻豆一区二区在线| 欧美一级二级在线观看| 丝袜亚洲另类欧美综合| 欧美肥大bbwbbw高潮| 亚洲h在线观看| 欧美日韩久久久一区| 午夜日韩在线电影| 欧美精品123区| 麻豆国产欧美日韩综合精品二区| 日韩视频免费观看高清完整版在线观看| 青青草一区二区三区| 日韩一级视频免费观看在线| 久久黄色级2电影| 久久久久久久久久看片| 丁香婷婷综合五月| 亚洲欧洲制服丝袜| 欧美少妇一区二区| 日日摸夜夜添夜夜添国产精品| 欧美一区二区视频网站| 老汉av免费一区二区三区 | 国产女主播视频一区二区| 国产成人免费视频网站| 中文字幕中文乱码欧美一区二区| 成人国产精品视频| 亚洲高清一区二区三区| 91精品欧美综合在线观看最新| 久久99精品国产麻豆婷婷| 国产欧美视频在线观看| 91久久一区二区| 日本强好片久久久久久aaa| 久久久久久久久久久久久女国产乱| 成人av午夜影院| 性久久久久久久久久久久 | 国产精品美女久久福利网站| 91麻豆福利精品推荐|