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

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

?? ch03.htm

?? Learn SQL in an easy way...
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD>		<TITLE>Teach Yourself SQL in 21 Days, Second Edition -- Day 3 -- Expressions, Conditions, and Operators</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="../ch02/ch02.htm"><IMG SRC="../buttonart/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch04/ch04.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 3 -<BR>Expressions, Conditions, and Operators</FONT></H1></CENTER><H2><FONT COLOR="#000077">Objectives</FONT></H2><P>On Day 2, &quot;Introduction to the Query: The <TT>SELECT</TT> Statement,&quot;you used <TT>SELECT</TT> and <TT>FROM</TT> to manipulate data in interesting (anduseful) ways. Today you learn more about <TT>SELECT</TT> and <TT>FROM</TT> and expandthe basic query with some new terms to go with query, table, and row, as well asa new clause and a group of handy items called operators. When the sun sets on Day3, you will<UL>	<LI>Know what an expression is and how to use it	<P>	<LI>Know what a condition is and how to use it	<P>	<LI>Be familiar with the basic uses of the <TT>WHERE</TT> clause	<P>	<LI>Be able to use arithmetic, comparison, character, logical, and set operators	<P>	<LI>Have a working knowledge of some miscellaneous operators</UL><BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>We used Oracle's Personal Oracle7	to generate today's examples. Other implementations of SQL may differ slightly in	the way in which commands are entered or output is displayed, but the results are	basically the same for all implementations that conform to the ANSI standard. <HR></BLOCKQUOTE><H2><FONT COLOR="#000077">Expressions</FONT></H2><P>The definition of an expression is simple: An <I>expression</I> returns a value.Expression types are very broad, covering different data types such as String, Numeric,and Boolean. In fact, pretty much anything following a clause (<TT>SELECT</TT> or<TT>FROM</TT>, for example) is an expression. In the following example <TT>amount</TT>is an expression that returns the value contained in the <TT>amount</TT> column.</P><PRE><FONT COLOR="#0066FF">SELECT amount FROM checks;</FONT></PRE><P>In the following statement <TT>NAME, ADDRESS, PHONE</TT> and <TT>ADDRESSBOOK</TT>are expressions:</P><PRE><FONT COLOR="#0066FF">SELECT NAME, ADDRESS, PHONEFROM ADDRESSBOOK;</FONT></PRE><P>Now, examine the following expression:</P><PRE><FONT COLOR="#0066FF">WHERE NAME = 'BROWN'</FONT></PRE><P>It contains a condition, <TT>NAME = 'BROWN'</TT>, which is an example of a Booleanexpression. <TT>NAME = 'BROWN'</TT> will be either <TT>TRUE</TT> or <TT>FALSE</TT>,depending on the condition <TT>=</TT>.<H2><FONT COLOR="#000077">Conditions</FONT></H2><P>If you ever want to find a particular item or group of items in your database,you need one or more conditions. Conditions are contained in the <TT>WHERE</TT> clause.In the preceding example, the condition is</P><PRE><FONT COLOR="#0066FF">NAME = 'BROWN'</FONT></PRE><P>To find everyone in your organization who worked more than <TT>100</TT> hourslast month, your condition would be</P><PRE><FONT COLOR="#0066FF">NUMBEROFHOURS &gt; 100</FONT></PRE><P>Conditions enable you to make selective queries. In their most common form, conditionscomprise a variable, a constant, and a comparison operator. In the first examplethe variable is <TT>NAME</TT>, the constant is <TT>'BROWN'</TT>, and the comparisonoperator is <TT>=</TT>. In the second example the variable is <TT>NUMBEROFHOURS</TT>,the constant is <TT>100</TT>, and the comparison operator is <TT>&gt;</TT>. You needto know about two more elements before you can write conditional queries: the <TT>WHERE</TT>clause and operators.<H3><FONT COLOR="#000077">The WHERE Clause</FONT></H3><P>The syntax of the <TT>WHERE</TT> clause is</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">WHERE &lt;SEARCH CONDITION&gt;</FONT></PRE><P><TT>SELECT</TT>, <TT>FROM</TT>, and <TT>WHERE</TT> are the three most frequentlyused clauses in SQL. <TT>WHERE</TT> simply causes your queries to be more selective.Without the <TT>WHERE</TT> clause, the most useful thing you could do with a queryis display all records in the selected table(s). For example:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM BIKES;</B></FONT></PRE><P>lists all rows of data in the table <TT>BIKES</TT>.</P><H5>OUTPUT:</H5><PRE><FONT COLOR="#0066FF">NAME           FRAMESIZE COMPOSITION  MILESRIDDEN TYPE-------------- --------- ------------ ----------- -------TREK 2300           22.5 CARBON FIBER        3500 RACINGBURLEY                22 STEEL               2000 TANDEMGIANT                 19 STEEL               1500 COMMUTERFUJI                  20 STEEL                500 TOURINGSPECIALIZED           16 STEEL                100 MOUNTAINCANNONDALE          22.5 ALUMINUM            3000 RACING</FONT></PRE><PRE><FONT COLOR="#0066FF">6 rows selected.</FONT></PRE><P>If you wanted a particular bike, you could type</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT *     FROM BIKES     WHERE NAME = 'BURLEY';</B></FONT></PRE><P>which would yield only one record:</P><PRE><FONT COLOR="#0066FF">NAME           FRAMESIZE COMPOSITION    MILESRIDDEN TYPE-------------- --------- -------------- ----------- -------BURLEY                22 STEEL                 2000 TANDEM</FONT></PRE><H5>ANALYSIS:</H5><P>This simple example shows how you can place a condition on the data that you wantto retrieve.<H2><FONT COLOR="#000077">Operators</FONT></H2><P>Operators are the elements you use inside an expression to articulate how youwant specified conditions to retrieve data. Operators fall into six groups: arithmetic,comparison, character, logical, set, and miscellaneous.<H3><FONT COLOR="#000077">Arithmetic Operators</FONT></H3><P>The arithmetic operators are plus (<TT>+</TT>), minus (-), divide (<TT>/</TT>),multiply (<TT>*</TT>), and modulo (<TT>%</TT>). The first four are self-explanatory.Modulo returns the integer remainder of a division. Here are two examples:</P><PRE><FONT COLOR="#0066FF">5 % 2 = 16 % 2 = 0</FONT></PRE><P>The modulo operator does not work with data types that have decimals, such asReal or Number.</P><P>If you place several of these arithmetic operators in an expression without anyparentheses, the operators are resolved in this order: multiplication, division,modulo, addition, and subtraction. For example, the expression</P><PRE><FONT COLOR="#0066FF">2*6+9/3</FONT></PRE><P>equals</P><PRE><FONT COLOR="#0066FF">12 + 3 = 15</FONT></PRE><P>However, the expression</P><PRE><FONT COLOR="#0066FF">2 * (6 + 9) / 3</FONT></PRE><P>equals</P><PRE><FONT COLOR="#0066FF">2 * 15 / 3 = 10</FONT></PRE><P>Watch where you put those parentheses! Sometimes the expression does exactly whatyou tell it to do, rather than what you want it to do.</P><P>The following sections examine the arithmetic operators in some detail and giveyou a chance to write some queries.<H4><FONT COLOR="#000077">Plus (+)</FONT></H4><P>You can use the plus sign in several ways. Type the following statement to displaythe <TT>PRICE</TT> table:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM PRICE;</B></FONT></PRE><H5><FONT COLOR="#000000">OUTPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">ITEM            WHOLESALE-------------- ----------TOMATOES              .34POTATOES              .51BANANAS               .67TURNIPS               .45CHEESE                .89APPLES                .23</FONT></PRE><PRE><FONT COLOR="#0066FF">6 rows selected.</FONT></PRE><P>Now type:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT ITEM, WHOLESALE, WHOLESALE + 0.15    FROM PRICE;</B></FONT></PRE><P>Here the <TT>+</TT> adds 15 cents to each price to produce the following:</P><PRE><FONT COLOR="#0066FF">ITEM           WHOLESALE WHOLESALE+0.15-------------- --------- --------------TOMATOES             .34            .49POTATOES             .51            .66BANANAS              .67            .82TURNIPS              .45            .60CHEESE               .89           1.04APPLES               .23            .38</FONT></PRE><PRE><FONT COLOR="#0066FF">6 rows selected.</FONT></PRE><H5>ANALYSIS:</H5><P>What is this last column with the unattractive column heading <TT>WHOLESALE+0.15</TT>?It's not in the original table. (Remember, you used <TT>*</TT> in the <TT>SELECT</TT>clause, which causes all the columns to be shown.) SQL allows you to create a virtualor derived column by combining or modifying existing columns.</P><P>Retype the original entry:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM PRICE;</B></FONT></PRE><P>The following table results:</P><PRE><FONT COLOR="#0066FF">ITEM           WHOLESALE-------------- ---------TOMATOES             .34POTATOES             .51BANANAS              .67TURNIPS              .45CHEESE               .89APPLES               .23</FONT></PRE><PRE><FONT COLOR="#0066FF">6 rows selected.</FONT></PRE><H5>ANALYSIS:</H5><P>The output confirms that the original data has not been changed and that the columnheading <TT>WHOLESALE+0.15</TT> is not a permanent part of it. In fact, the columnheading is so unattractive that you should do something about it.</P><P>Type the following:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT ITEM, WHOLESALE, (WHOLESALE + 0.15) RETAIL    FROM PRICE;</B></FONT></PRE><P>Here's the result:</P><PRE><FONT COLOR="#0066FF">ITEM           WHOLESALE  RETAIL-------------- ---------  ------TOMATOES             .34     .49POTATOES             .51     .66BANANAS              .67     .82TURNIPS              .45     .60CHEESE               .89    1.04APPLES               .23     .38</FONT></PRE><PRE><FONT COLOR="#0066FF">6 rows selected.</FONT></PRE><H5>ANALYSIS:</H5><P>This is wonderful! Not only can you create new columns, but you can also renamethem on the fly. You can rename any of the columns using the syntax <TT>column_namealias</TT> (note the space between <TT>column_name</TT> and <TT>alias</TT>).</P><P>For example, the query</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT ITEM PRODUCE, WHOLESALE, WHOLESALE + 0.25 RETAIL     FROM PRICE;</B></FONT></PRE><P>renames the columns as follows:</P><PRE><FONT COLOR="#0066FF">PRODUCE        WHOLESALE    RETAIL-------------- --------- ---------TOMATOES             .34       .59POTATOES             .51       .76BANANAS              .67       .92TURNIPS              .45       .70CHEESE               .89      1.14APPLES               .23       .48</FONT></PRE><BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Some implementations of SQL use	the syntax <TT>&lt;column name = alias&gt;</TT>. The preceding example would be written	as follows:</P>	<PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT ITEM = PRODUCE,     WHOLESALE,     WHOLESALE + 0.25 = RETAIL,     FROM PRICE;</B></FONT></PRE>	<P>Check your implementation for the exact syntax. <HR></BLOCKQUOTE><P>You might be wondering what use aliasing is if you are not using command-lineSQL. Fair enough. Have you ever wondered how report builders work? Someday, whenyou are asked to write a report generator, you'll remember this and not spend weeksreinventing what Dr. Codd and IBM have wrought.</P><P>So far, you have seen two uses of the plus sign. The first instance was the useof the plus sign in the <TT>SELECT</TT> clause to perform a calculation on the dataand display the calculation. The second use of the plus sign is in the <TT>WHERE</TT>clause. Using operators in the <TT>WHERE</TT> clause gives you more flexibility whenyou specify conditions for retrieving data.</P><P>In some implementations of SQL, the plus sign does double duty as a characteroperator. You'll see that side of the plus a little later today.<H4><FONT COLOR="#000077">Minus (-)</FONT></H4><P>Minus also has two uses. First, it can change the sign of a number. You can usethe table <TT>HILOW</TT> to demonstrate this function.</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt;<B> SELECT * FROM HILOW;</B></FONT></PRE><H5><FONT COLOR="#000000">OUTPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">STATE      HIGHTEMP   LOWTEMP---------- -------- ---------CA              -50       120FL               20       110LA               15        99ND              -70       101NE              -60       100</FONT></PRE><P>For example, here's a way to manipulate the data:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT STATE, -HIGHTEMP LOWS, -LOWTEMP HIGHS     FROM HILOW;</B>STATE          LOWS     HIGHS---------- -------- ---------CA               50      -120FL              -20      -110LA              -15       -99ND               70      -101NE               60      -100</FONT></PRE><P>The second (and obvious) use of the minus sign is to subtract one column fromanother. For example:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT STATE,</B>  2<B>  HIGHTEMP LOWS,</B>  3 <B> LOWTEMP HIGHS,</B>  4<B>  (LOWTEMP - HIGHTEMP) DIFFERENCE</B>  5 <B> FROM HILOW;</B>STATE          LOWS    HIGHS DIFFERENCE---------- -------- -------- ----------CA              -50      120        170FL               20      110         90LA               15       99         84ND              -70      101        171NE              -60      100        160</FONT></PRE><P>Notice the use of aliases to fix the data that was entered incorrectly. This remedyis merely a temporary patch, though, and not a permanent fix. You should see to itthat the data is corrected and entered correctly in the future. On Day 21, &quot;CommonSQL Mistakes/Errors and Resolutions,&quot; you'll learn how to correct bad data.</P><P>This query not only fixed (at least visually) the incorrect data but also createda new column containing the difference between the highs and lows of each state.</P><P>If you accidentally use the minus sign on a character field, you get somethinglike this:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt;<B> SELECT -STATE FROM HILOW;</B>ERROR:ORA-01722: invalid numberno rows selected</FONT></PRE><P>The exact error message varies with implementation, but the result is the same.<H4><FONT COLOR="#000077">Divide (/)</FONT></H4><P>The division operator has only the one obvious meaning. Using the table <TT>PRICE</TT>,type the following:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM PRICE;</B></FONT></PRE><H5><FONT COLOR="#000000">OUTPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">ITEM           WHOLESALE-------------- ---------TOMATOES             .34POTATOES             .51BANANAS              .67TURNIPS              .45CHEESE               .89APPLES               .23</FONT></PRE><PRE><FONT COLOR="#0066FF">6 rows selected.</FONT></PRE><P>You can show the effects of a two-for-one sale by typing the next statement:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT ITEM, WHOLESALE, (WHOLESALE/2) SALEPRICE  2  FROM PRICE;</B>ITEM           WHOLESALE SALEPRICE-------------- --------- ---------TOMATOES             .34       .17POTATOES             .51      .255BANANAS              .67      .335TURNIPS              .45      .225CHEESE               .89      .445APPLES               .23      .115

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久电影网站中文字幕| 国产精品乱码人人做人人爱| 一区二区三区av电影| 欧美性生交片4| 裸体在线国模精品偷拍| 精品国产一区久久| 成人天堂资源www在线| 国产精品不卡在线| 91麻豆精品一区二区三区| 一区二区三区日韩| 欧美精品精品一区| 精品无人码麻豆乱码1区2区| 国产亚洲va综合人人澡精品 | 日本韩国一区二区| 午夜电影久久久| 精品久久国产字幕高潮| 成人精品一区二区三区四区| 玉足女爽爽91| 欧美一级日韩免费不卡| 成人av在线播放网址| 亚洲免费高清视频在线| 欧美大片免费久久精品三p| 国产一区视频导航| 亚洲精选在线视频| 日韩精品一区二区三区视频在线观看 | 久久综合久色欧美综合狠狠| 成人a级免费电影| 视频一区视频二区在线观看| 国产欧美一区二区在线观看| 在线观看日韩高清av| 国产在线日韩欧美| 亚洲国产精品视频| 久久精品视频一区二区| 欧美日韩国产免费| 成人激情免费视频| 蜜桃视频免费观看一区| 亚洲私人黄色宅男| 精品国产一区二区三区久久久蜜月| 不卡一二三区首页| 久久99国产精品久久99| 亚洲精品亚洲人成人网在线播放| 久久亚洲一级片| 精品视频在线视频| 99久久精品免费看国产免费软件| 久热成人在线视频| 亚洲国产日日夜夜| 亚洲美女屁股眼交3| 精品久久久久久无| 欧美一区二区三区系列电影| 成人av电影在线播放| 激情欧美一区二区| 奇米888四色在线精品| 亚洲免费在线看| 国产精品无圣光一区二区| 日韩欧美三级在线| 欧美日韩国产免费| 欧美日韩视频不卡| 在线一区二区视频| 91美女片黄在线| 成人免费观看视频| 国产麻豆精品久久一二三| 日本欧美在线观看| 日韩av电影一区| 婷婷国产在线综合| 亚洲成a人片在线观看中文| 夜夜嗨av一区二区三区中文字幕| 成人欧美一区二区三区黑人麻豆 | 全部av―极品视觉盛宴亚洲| 亚洲国产成人porn| 亚洲综合成人网| 亚洲成人在线免费| 秋霞影院一区二区| 日本欧美韩国一区三区| 亚洲免费资源在线播放| 1区2区3区国产精品| 国产精品欧美一区喷水| 中文字幕不卡的av| 中文字幕一区二区三区在线播放| 国产精品美女久久久久久久久| 久久久久久久综合日本| 国产欧美日韩精品a在线观看| 久久综合久久99| 国产日韩v精品一区二区| 久久久久9999亚洲精品| 国产网红主播福利一区二区| 国产欧美日韩精品一区| 亚洲男人天堂一区| 午夜精品久久久久| 免费观看一级特黄欧美大片| 麻豆国产精品777777在线| 美国精品在线观看| 国产精品1区二区.| 99re这里只有精品6| 91久久精品网| 91麻豆精品国产| 久久久久9999亚洲精品| 国产精品免费丝袜| 午夜激情一区二区三区| 激情五月激情综合网| 国产a区久久久| 欧美吻胸吃奶大尺度电影| 日韩一区二区免费高清| 精品国产免费视频| 亚洲欧洲美洲综合色网| 亚洲第一电影网| 国模少妇一区二区三区| 99国产精品99久久久久久| 欧美日产在线观看| 久久久av毛片精品| 一区二区久久久久| 黄色成人免费在线| 91福利社在线观看| 精品福利一区二区三区| 亚洲欧洲精品一区二区精品久久久| 亚洲国产日韩精品| 国产成人在线视频网址| 在线观看国产精品网站| xf在线a精品一区二区视频网站| 亚洲男女毛片无遮挡| 久久99热国产| 在线免费精品视频| 久久久久9999亚洲精品| 五月激情丁香一区二区三区| 成人福利在线看| 日韩精品一区二区三区中文精品| 日本一区二区三级电影在线观看| 日韩黄色免费电影| 99国产精品久| 国产日韩在线不卡| 日本不卡一二三区黄网| 91久久精品一区二区二区| 国产清纯美女被跳蛋高潮一区二区久久w | 国产日韩欧美综合一区| 五月激情丁香一区二区三区| 99热精品国产| 久久久国产一区二区三区四区小说| 午夜精品免费在线观看| 92国产精品观看| 国产婷婷色一区二区三区四区| 秋霞成人午夜伦在线观看| 色8久久精品久久久久久蜜 | 制服丝袜在线91| 亚洲九九爱视频| 99久久夜色精品国产网站| 久久精品一区蜜桃臀影院| 日本一道高清亚洲日美韩| 91久久奴性调教| 国产精品久久久久久亚洲毛片 | 国产亚洲精品久| 国产自产2019最新不卡| 日韩一区二区影院| 日韩精品成人一区二区三区| 欧美制服丝袜第一页| 亚洲黄色免费网站| 99国产一区二区三精品乱码| 欧美国产综合一区二区| 国产精品996| 久久久久97国产精华液好用吗| 精品一区二区免费在线观看| 欧美一级电影网站| 日韩av一区二区三区| 欧美一区2区视频在线观看| 午夜欧美电影在线观看| 欧美在线看片a免费观看| 一区二区在线观看免费视频播放 | 国产一区二区免费在线| 日韩欧美国产成人一区二区| 琪琪一区二区三区| 欧美一区二区三区色| 青青草原综合久久大伊人精品优势| 欧美日韩三级一区| 日韩二区三区四区| 日韩一区二区免费高清| 国产一区二区在线电影| 国产欧美一区二区精品仙草咪| 国产一区二区女| 国产精品午夜在线观看| 99re成人在线| 亚洲精品五月天| 欧美视频一二三区| 亚洲1区2区3区视频| 3751色影院一区二区三区| 美女任你摸久久| 久久久久久久综合色一本| 成人免费的视频| 亚洲制服丝袜av| 欧美日韩国产电影| 美女在线一区二区| 久久亚洲一区二区三区四区| 99精品国产视频| 午夜精品福利一区二区三区av| 日韩欧美成人午夜| 成人小视频免费观看| 一区二区三区四区在线播放| 91麻豆精品国产91久久久资源速度| 蜜臀久久99精品久久久画质超高清| 欧美www视频| 99这里都是精品| 青娱乐精品视频在线| 国产精品乱人伦中文|