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

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

?? ch06.htm

?? 21精通SQL
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
     76 ROAD BIKE                 530.00 BIKE SPEC           54
     10 TANDEM                   1200.00 BIKE SPEC           54
</FONT></PRE>


<BLOCKQUOTE>
	<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>The syntax you used to get this
	join--<TT>JOIN</TT> <TT>ON</TT>--is not ANSI standard. The implementation you used
	for this example has additional syntax. You are using it here to specify an inner
	and an outer join. Most implementations of SQL have similar extensions. Notice the
	absence of the <TT>WHERE</TT> clause in this type of join. 
<HR>


</BLOCKQUOTE>

<H5>ANALYSIS:</H5>
<P>The result is that all the rows in <TT>PART</TT> are spliced on to specific rows
in <TT>ORDERS</TT> where the column <TT>PARTNUM</TT> is <TT>54</TT>. Here's a <TT>RIGHT
OUTER JOIN </TT>statement:</P>
<H5>INPUT/OUTPUT:</H5>
<PRE><FONT COLOR="#0066FF"><B>SELECT P.PARTNUM, P.DESCRIPTION,P.PRICE,
O.NAME, O.PARTNUM
FROM PART P
RIGHT OUTER JOIN ORDERS O ON ORDERS.PARTNUM = 54
</B>
PARTNUM DESCRIPTION          PRICE   NAME           PARTNUM
======= ==================== ======= ============== =======

 &lt;null&gt; &lt;null&gt;                &lt;null&gt; TRUE WHEEL          23
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; TRUE WHEEL          76
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; TRUE WHEEL          10
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; TRUE WHEEL          42
     54 PEDALS                 54.25 BIKE SPEC           54
     42 SEATS                  24.50 BIKE SPEC           54
     46 TIRES                  15.25 BIKE SPEC           54
     23 MOUNTAIN BIKE         350.45 BIKE SPEC           54
     76 ROAD BIKE             530.00 BIKE SPEC           54
     10 TANDEM               1200.00 BIKE SPEC           54
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; BIKE SPEC           10
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; BIKE SPEC           23
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; BIKE SPEC           76
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; LE SHOPPE           76
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; LE SHOPPE           10
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; AAA BIKE            10
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; AAA BIKE            76
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; AAA BIKE            46
 &lt;null&gt; &lt;null&gt;                &lt;null&gt; JACKS BIKE          76
</FONT></PRE>
<H5>ANALYSIS:</H5>
<P>This type of query is new. First you specified a <TT>RIGHT OUTER JOIN</TT>, which
caused SQL to return a full set of the right table, <TT>ORDERS</TT>, and to place
nulls in the fields where <TT>ORDERS.PARTNUM &lt;&gt; 54</TT>. Following is a <TT>LEFT
OUTER JOIN</TT> statement:</P>
<H5>INPUT/OUTPUT:</H5>
<PRE><FONT COLOR="#0066FF"><B>SELECT P.PARTNUM, P.DESCRIPTION,P.PRICE,
O.NAME, O.PARTNUM
FROM PART P
LEFT OUTER JOIN ORDERS O ON ORDERS.PARTNUM = 54</B>

PARTNUM DESCRIPTION              PRICE NAME           PARTNUM
======= ================== =========== ========== ===========

     54 PEDALS                   54.25 BIKE SPEC           54
     42 SEATS                    24.50 BIKE SPEC           54
     46 TIRES                    15.25 BIKE SPEC           54
     23 MOUNTAIN BIKE           350.45 BIKE SPEC           54
     76 ROAD BIKE               530.00 BIKE SPEC           54
     10 TANDEM                 1200.00 BIKE SPEC           54
</FONT></PRE>
<H5>ANALYSIS:</H5>
<P>You get the same six rows as the <TT>INNER JOIN</TT>. Because you specified <TT>LEFT</TT>
(the <TT>LEFT</TT> table), <TT>PART</TT> determined the number of rows you would
return. Because <TT>PART</TT> is smaller than <TT>ORDERS</TT>, SQL saw no need to
pad those other fields with blanks.</P>
<P>Don't worry too much about inner and outer joins. Most SQL products determine
the optimum <TT>JOIN</TT> for your query. In fact, if you are placing your query
into a stored procedure (or using it inside a program (both stored procedures and
Embedded SQL covered on Day 13, &quot;Advanced SQL Topics&quot;), you should not
specify a join type even if your SQL implementation provides the proper syntax. If
you do specify a join type, the optimizer chooses your way instead of the optimum
way.</P>
<P>Some implementations of SQL use the <TT>+</TT> sign instead of an <TT>OUTER</TT>
<TT>JOIN</TT> statement. The <TT>+</TT> simply means &quot;Show me everything even
if something is missing.&quot; Here's the syntax:</P>
<H5>SYNTAX:</H5>
<PRE><FONT COLOR="#0066FF">SQL&gt; select e.name, e.employee_id, ep.salary,
            ep.marital_status
     from e,ployee_tbl e,
          employee_pay_tbl ep
     where e.employee_id = ep.employee_id(+)
      and e.name like '%MITH';
</FONT></PRE>
<H5>ANALYSIS:</H5>
<P>This statement is joining the two tables. The <TT>+</TT> sign on the <TT>ep.employee_id</TT>
column will return all rows even if they are empty.
<H2><FONT COLOR="#000077">Joining a Table to Itself</FONT></H2>
<P>Today's final topic is the often-used technique of joining a table to itself.
The syntax of this operation is similar to joining two tables. For example, to join
table <TT>TABLE1</TT> to itself, type this:</P>
<H5>INPUT:</H5>
<PRE><FONT COLOR="#0066FF"><B>SELECT *
FROM TABLE1, TABLE1</B></FONT></PRE>
<H5><FONT COLOR="#000000"><B>OUTPUT:</B></FONT></H5>
<PRE><FONT COLOR="#000000"><B></B></FONT></PRE>
<PRE><FONT COLOR="#0066FF">ROW        REMARKS    ROW        REMARKS
========== ========== ========== ========

row 1      Table 1    row 1      Table 1
row 1      Table 1    row 2      Table 1
row 1      Table 1    row 3      Table 1
row 1      Table 1    row 4      Table 1
row 1      Table 1    row 5      Table 1
row 1      Table 1    row 6      Table 1
row 2      Table 1    row 1      Table 1
row 2      Table 1    row 2      Table 1
row 2      Table 1    row 3      Table 1
row 2      Table 1    row 4      Table 1
row 2      Table 1    row 5      Table 1
row 2      Table 1    row 6      Table 1
row 3      Table 1    row 1      Table 1
row 3      Table 1    row 2      Table 1
row 3      Table 1    row 3      Table 1
row 3      Table 1    row 4      Table 1
row 3      Table 1    row 5      Table 1
row 3      Table 1    row 6      Table 1
row 4      Table 1    row 1      Table 1
row 4      Table 1    row 2      Table 1
...
</FONT></PRE>
<H5>ANALYSIS:</H5>
<P>In its complete form, this join produces the same number of combinations as joining
two 6-row tables. This type of join could be useful to check the internal consistency
of data. What would happen if someone fell asleep in the production department and
entered a new part with a <TT>PARTNUM</TT> that already existed? That would be bad
news for everybody: Invoices would be wrong; your application would probably blow
up; and in general you would be in for a very bad time. And the cause of all your
problems would be the duplicate <TT>PARTNUM</TT> in the following table:</P>
<H5>INPUT/OUTPUT:</H5>
<PRE><FONT COLOR="#0066FF"><B>SELECT * FROM PART</B>

    PARTNUM DESCRIPTION                PRICE
=========== ==================== ===========

         54 PEDALS                     54.25
         42 SEATS                      24.50
         46 TIRES                      15.25
         23 MOUNTAIN BIKE             350.45
         76 ROAD BIKE                 530.00
         10 TANDEM                   1200.00
         76 CLIPPLESS SHOE             65.00 &lt;-NOTE SAME #
</FONT></PRE>
<P>You saved your company from this bad situation by checking <TT>PART</TT> before
anyone used it:</P>
<H5>INPUT/OUTPUT:</H5>
<PRE><FONT COLOR="#0066FF"><B>SELECT F.PARTNUM, F.DESCRIPTION,
S.PARTNUM,S.DESCRIPTION
FROM PART F, PART S
WHERE F.PARTNUM = S.PARTNUM
AND F.DESCRIPTION &lt;&gt; S.DESCRIPTION</B>

   PARTNUM DESCRIPTION              PARTNUM DESCRIPTION
========== ======================== ======= ============

        76 ROAD BIKE                     76 CLIPPLESS SHOE
        76 CLIPPLESS SHOE                76 ROAD BIKE
</FONT></PRE>
<H5>ANALYSIS:</H5>
<P>Now you are a hero until someone asks why the table has only two entries. You,
remembering what you have learned about <TT>JOIN</TT>s, retain your hero status by
explaining how the join produced two rows that satisfied the condition <TT>WHERE
F.PARTNUM = S.PARTNUM AND F.DESCRIPTION &lt;&gt; S.DESCRIPTION</TT>. Of course, at
some point, the row of data containing the duplicate <TT>PARTNUM</TT> would have
to be corrected.
<H2><FONT COLOR="#000077">Summary</FONT></H2>
<P>Today you learned that a join combines all possible combinations of rows present
in the selected tables. These new rows are then available for selection based on
the information that you want.</P>
<P>Congratulations--you have learned almost everything there is to know about the
<TT>SELECT</TT> clause. The one remaining item, subqueries, is covered tomorrow (Day
7, &quot;Subqueries: The Embedded <TT>SELECT</TT> Statement&quot;).
<H2><FONT COLOR="#000077">Q&amp;A</FONT></H2>

<DL>
	<DD><B>Q Why cover outer, inner, left, and right joins when I probably won't ever
	use them?</B>
	<P><B>A</B> A little knowledge is a dangerous thing, and no knowledge can be expensive.
	You now know enough to understand the basics of what your SQL engine might try while
	optimizing you queries.</P>
	<P><B>Q How many tables can you join on?</B></P>
	<P><B>A </B>That depends on the implementation. Some implementations have a 25-table
	limit, whereas others have no limit. Just remember, the more tables you join on,
	the slower the response time will be. To be safe, check your implementation to find
	out the maximum number of tables allowed in a query.</P>
	<P><B>Q Would it be fair to say that when tables are joined, they actually become
	one table?</B></P>
	<P><B>A </B>Very simply put, that is just about what happens. When you join the tables,
	you can select from any of the columns in either table.
</DL>

<H2><FONT COLOR="#000077">Workshop</FONT></H2>
<P>The Workshop provides quiz questions to help solidify your understanding of the
material covered, as well as exercises to provide you with experience in using what
you have learned. Try to answer the quiz and exercise questions before checking the
answers in Appendix F, &quot;Answers to Quizzes and Exercises.&quot;
<H3><FONT COLOR="#000077">Quiz</FONT></H3>

<DL>
	<DD><B>1.</B> How many rows would a two-table join produce if one table had 50,000
	rows and the other had 100,000?
	<P><B>2.</B> What type of join appears in the following <TT>SELECT</TT> statement?
</DL>



<BLOCKQUOTE>
	<PRE><FONT COLOR="#0066FF"> select e.name, e.employee_id, ep.salary
 from employee_tbl e,
      employee_pay_tbl ep
 where e.employee_id = ep.employee_id;</FONT></PRE>

</BLOCKQUOTE>


<DL>
	<DD><B>3.</B> Will the following <TT>SELECT</TT> statements work?
</DL>



<BLOCKQUOTE>

	<BLOCKQUOTE>
		<P><FONT COLOR="#000000">a. </FONT><FONT COLOR="#0066FF"><TT>select name, employee_id,
		salary    <BR>
		  from employee_tbl e, <BR>
		       employee_pay_tbl ep    <BR>
		  where employee_id = employee_id <BR>
		    and name like '%MITH';<BR>
		</TT></FONT></P>

		<P><FONT COLOR="#000000">b. </FONT><FONT COLOR="#0066FF"><TT>select e.name, e.employee_id,
		ep.salary    <BR>
		  from employee_tbl e,  <BR>
		       employee_pay_tbl ep <BR>
		  where name like '%MITH';<BR>
		</TT></FONT></P>

		<P><FONT COLOR="#000000">c. </FONT><FONT COLOR="#0066FF"><TT>select e.name, e.employee_id,
		ep.salary    <BR>
		  from employee_tbl e, <BR>
		       employee_pay_tbl ep  <BR>
		  where e.employee_id = ep.employee_id <BR>
		    and e.name like '%MITH';</TT></FONT></P>

	</BLOCKQUOTE>

</BLOCKQUOTE>


<DL>
	<DD><B>4. </B>In the <TT>WHERE</TT> clause, when joining the tables, should you do
	the join first or the conditions?
	<P><B>5.</B> In joining tables are you limited to one-column joins, or can you join
	on more than one column?
</DL>

<H3><FONT COLOR="#000077">Exercises</FONT></H3>

<DL>
	<DD><B>1. </B>In the section on joining tables to themselves, the last example returned
	two combinations. Rewrite the query so only one entry comes up for each redundant
	part number.
	<P><B>2. </B>Rewrite the following query to make it more readable and shorter.</P>
	<H5>INPUT:</H5>
</DL>

<PRE><FONT COLOR="#0066FF">      <B>select orders.orderedon, orders.name, part.partnum,
               part.price, part.description from orders, part
               where orders.partnum = part.partnum and orders.orderedon
               between '1-SEP-96' and '30-SEP-96'
               order by part.partnum;</B>
</FONT></PRE>

<DL>
	<DD><B>3. </B>From the <TT>PART</TT> table and the <TT>ORDERS</TT> table, make up
	a query that will return the following:
	<H5>OUTPUT:</H5>
</DL>

<PRE></PRE>


<BLOCKQUOTE>
	<PRE><FONT COLOR="#0066FF">ORDEREDON             NAME               PARTNUM     QUANTITY
==================    ================== =======     ========

2-SEP-96              TRUE WHEEL              10            1</FONT></PRE>

</BLOCKQUOTE>

<CENTER>
<P>
<HR>
<A HREF="ch05.htm" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/ch05.htm"><IMG SRC="previous.gif" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="ch07.htm" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/ch07.htm"><IMG
SRC="next.gif" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"
BORDER="0"></A><A HREF="index-1.htm" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/index-1.htm"><IMG SRC="contents.gif" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/contents.gif" WIDTH="128"
HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A><BR>
<BR>
<BR>
<IMG SRC="corp.gif" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/corp.gif" WIDTH="284" HEIGHT="45" ALIGN="BOTTOM" ALT="Macmillan Computer Publishing USA"
BORDER="0"></P>

<P>&#169; <A HREF="copy.htm" tppabs="http://202.113.16.101/%7eeb%7e/Teach%20Yourself%20MS%20SQL%20Server%206.5%20in%2021%20Days/copy.htm">Copyright</A>, Macmillan Computer Publishing. All
rights reserved.
</CENTER>


</BODY>

</HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区四区亚洲| 丝袜亚洲精品中文字幕一区| 欧美一区二区三区男人的天堂| 午夜电影久久久| 国产激情精品久久久第一区二区| 精彩视频一区二区三区| 偷拍与自拍一区| 成人av网站在线| 久久夜色精品国产噜噜av| 九九视频精品免费| 久久精品国产秦先生| 大美女一区二区三区| 欧美日韩精品高清| 国产亚洲一区二区三区四区| 亚洲福利一区二区| 另类小说一区二区三区| 91亚洲国产成人精品一区二三| 欧美性三三影院| 国产精品久久久久四虎| 日本网站在线观看一区二区三区 | 国产精品拍天天在线| 亚洲综合色区另类av| 久久久久久久电影| 久久精品一区四区| 中文字幕亚洲区| 亚洲午夜影视影院在线观看| 午夜欧美在线一二页| 久久精品国内一区二区三区| 国产精品一二三区在线| 色呦呦一区二区三区| 欧美日韩不卡在线| 欧美一卡二卡三卡| 久久青草欧美一区二区三区| 国产精品第13页| 亚洲精品少妇30p| 日本不卡一二三| 成人国产精品免费| www.激情成人| 欧美午夜片在线看| 精品久久免费看| 亚洲人午夜精品天堂一二香蕉| 亚洲444eee在线观看| 国产经典欧美精品| 欧美亚洲动漫精品| 欧美韩国一区二区| 日本不卡中文字幕| 一本大道av一区二区在线播放| 日韩小视频在线观看专区| 中文字幕在线观看不卡| 久久91精品国产91久久小草| 色播五月激情综合网| 久久色视频免费观看| 午夜精品成人在线视频| 成人18精品视频| 精品国免费一区二区三区| 亚洲一区二区偷拍精品| 国产成人一级电影| 欧美一区二区三区爱爱| 亚洲国产美国国产综合一区二区| 国产一区二区成人久久免费影院 | 中文字幕中文字幕在线一区| 蜜桃久久久久久| 欧美三级三级三级爽爽爽| 国产精品美女久久久久久2018| 久久国内精品自在自线400部| 色综合欧美在线| 国产精品欧美极品| 国产白丝网站精品污在线入口| 日韩精品一区二区三区三区免费| 亚洲无人区一区| 欧美日韩三级在线| 亚洲电影一区二区三区| 在线看国产一区| 亚洲一级二级三级| 欧美三级日韩三级| 午夜精品在线看| 欧美在线观看禁18| 亚洲国产欧美日韩另类综合| 在线免费一区三区| 一个色在线综合| 欧美网站一区二区| 亚洲sss视频在线视频| 欧美日韩国产首页| 日本欧美一区二区在线观看| 日韩一区二区三免费高清| 久久爱www久久做| 国产三级一区二区三区| 国产suv精品一区二区6| 国产精品久久久久久久久久久免费看| 国产盗摄精品一区二区三区在线 | 一本色道**综合亚洲精品蜜桃冫| 亚洲欧洲性图库| 在线观看av不卡| 日韩有码一区二区三区| 日韩一区二区三区在线视频| 国产在线视视频有精品| 欧美激情一区三区| 91久久精品网| 欧美a级理论片| 中文在线资源观看网站视频免费不卡 | 亚洲人成人一区二区在线观看 | 中文字幕一区二区在线播放| 99精品视频一区二区三区| 一区二区三区中文免费| 日韩一区二区三| 成人午夜碰碰视频| 三级在线观看一区二区| 国产日韩精品一区二区三区 | 五月天一区二区| 久久久亚洲午夜电影| 91在线精品一区二区| 午夜成人免费电影| 国产精品色哟哟| 欧美精品在线一区二区三区| 国产精品996| 午夜精品福利视频网站| 日本一区二区成人| 欧美日韩成人激情| 成人的网站免费观看| 日韩电影免费在线| 亚洲男女毛片无遮挡| 日韩一区二区三区观看| 91一区二区三区在线播放| 韩国女主播成人在线| 亚洲一区二区三区四区不卡| 国产欧美日韩卡一| 制服丝袜亚洲精品中文字幕| 99国产欧美另类久久久精品| 久久99国产精品免费| 亚洲自拍与偷拍| 国产精品久久久久久久午夜片| 欧美一区二区在线免费播放| 色综合久久久久网| 国产精华液一区二区三区| 蜜桃精品视频在线观看| 亚洲精品自拍动漫在线| 日本一区免费视频| 欧美精品一区二区三区久久久| 欧美日韩精品一区二区三区| 91免费版pro下载短视频| 粉嫩蜜臀av国产精品网站| 狠狠色狠狠色综合日日91app| 同产精品九九九| 亚洲国产精品久久久久婷婷884| 国产精品福利电影一区二区三区四区| 欧美精品一区二区三区蜜桃| 欧美白人最猛性xxxxx69交| 欧美日韩视频专区在线播放| 在线视频欧美区| 在线看日韩精品电影| 一本到不卡免费一区二区| 99精品1区2区| 色综合中文字幕| 91色在线porny| 色婷婷精品久久二区二区蜜臀av| www.亚洲精品| 91看片淫黄大片一级在线观看| 成人国产精品免费网站| 成人h动漫精品一区二区| 成人av影院在线| 日本高清免费不卡视频| 一本一道久久a久久精品| 91国产成人在线| 欧美日韩三级视频| 91精品国产91久久久久久最新毛片 | 日本成人在线网站| 久久爱另类一区二区小说| 国产精品1区2区3区| 国产激情视频一区二区在线观看| 国产成人精品免费| av电影天堂一区二区在线| 欧美日韩大陆一区二区| 欧美日韩国产小视频| 99视频精品全部免费在线| 成熟亚洲日本毛茸茸凸凹| 国产成人精品一区二区三区网站观看| 久久国产精品第一页| 国产精品一区二区在线观看网站| 成人综合在线观看| 91精品办公室少妇高潮对白| 91精品国产麻豆| 国产清纯白嫩初高生在线观看91| 国产精品你懂的| 亚洲成a人v欧美综合天堂下载| 日韩电影在线观看电影| 国产精一区二区三区| 日本二三区不卡| 日韩欧美中文字幕公布| 国产精品高潮呻吟| 午夜精品一区二区三区电影天堂| 精品在线播放免费| 一本久道久久综合中文字幕| 日韩一区二区三区精品视频| 亚洲天堂免费在线观看视频| 美国精品在线观看| 在线观看91视频| 国产精品理伦片| 蜜桃一区二区三区在线观看| 91女厕偷拍女厕偷拍高清| 欧美成人性战久久|