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

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

?? ch10.htm

?? Learn SQL in an easy way...
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
Software Company                250                  1Record Club                      25                  2Cable TV Company                 35                  3Debtor's Credit Card             35                  4U-O-Us Insurance Company        125                  5Joe's Car Palace                350                  5S.C. Student Loan               200                  610 rows selected.SQL&gt; <B>DROP INDEX ID_CMPD_INDEX;</B>Index dropped.</FONT></PRE><H5>ANALYSIS:</H5><P>You can achieve performance gains by selecting the column with the most uniquevalues. For instance, every value in the <TT>NAME</TT> field of the <TT>BILLS</TT>table is unique. When using a compound index, place the most selective field firstin the column list. That is, place the field that you expect to select most oftenat the beginning of the list. (The order in which the column names appear in the<TT>CREATE INDEX</TT> statement does not have to be the same as their order withinthe table.) Assume you are routinely using a statement such as the following:</P><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM BILLS WHERE NAME = &quot;Cable TV Company&quot;;</B></FONT></PRE><P>To achieve performance gains, you must create an index using the <TT>NAME</TT>field as the leading column. Here are two examples:</P><PRE><FONT COLOR="#0066FF">SQL&gt; <B>CREATE INDEX NAME_INDEX ON BILLS(NAME, AMOUNT);</B></FONT></PRE><P>or</P><PRE><FONT COLOR="#0066FF">SQL&gt; <B>CREATE INDEX NAME_INDEX ON BILLS(NAME);</B></FONT></PRE><P>The <TT>NAME</TT> field is the left-most column for both of these indexes, sothe preceding query would be optimized to search on the <TT>NAME</TT> field.</P><P>Composite indexes are also used to combine two or more columns that by themselvesmay have low selectivity. For an example of selectivity, examine the <TT>BANK_ACCOUNTS</TT>table:</P><PRE><FONT COLOR="#0066FF">ACCOUNT_ID     TYPE             BALANCE     BANK1              Checking         500         First Federal2              Money Market     1200        First Investor's3              Checking         90          Credit Union4              Savings          400         First Federal5              Checking         2500        Second Mutual6              Business         4500        Fidelity</FONT></PRE><P>Notice that out of six records, the value <TT>Checking</TT> appears in three ofthem. This column has a lower selectivity than the <TT>ACCOUNT_ID</TT> field. Noticethat every value of the <TT>ACCOUNT_ID</TT> field is unique. To improve the selectivityof your index, you could combine the <TT>TYPE</TT> and <TT>ACCOUNT_ID</TT> fieldsin a new index. This step would create a unique index value (which, of course, isthe highest selectivity you can get).<BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>An index containing multiple columns	is often referred to as a <I>composite index</I>. Performance issues may sway your	decision on whether to use a single-column or composite index. In Oracle, for example,	you may decide to use a single-column index if most of your queries involve one particular	column as part of a condition; on the other hand, you would probably create a composite	index if the columns in that index are often used together as conditions for a query.	Check your specific implementation on guidance when creating multiple-column indexes.	<HR></BLOCKQUOTE><H3><FONT COLOR="#000077">Using the UNIQUE Keyword with CREATE INDEX</FONT></H3><P>Composite indexes are often used with the <TT>UNIQUE</TT> keyword to prevent multiplerecords from appearing with the same data. Suppose you wanted to force the <TT>BILLS</TT>table to have the following built-in &quot;rule&quot;: Each bill paid to a companymust come from a different bank account. You would create a <TT>UNIQUE</TT> indexon the <TT>NAME</TT> and <TT>ACCOUNT_ID</TT> fields. Unfortunately, Oracle7 doesnot support the <TT>UNIQUE</TT> syntax. Instead, it implements the <TT>UNIQUE</TT>feature using the <TT>UNIQUE</TT> integrity constraint. The following example demonstratesthe <TT>UNIQUE</TT> keyword with <TT>CREATE INDEX</TT> using Sybase's Transact-SQLlanguage.</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">1&gt; <B>create unique index unique_id_name</B>2&gt; <B>on BILLS(ACCOUNT_ID, NAME)</B>3&gt; <B>go</B>1&gt; <B>select * from BILLS</B>2&gt; <B>go</B></FONT></PRE><H5><FONT COLOR="#000000">OUTPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">NAME                         AMOUNT     ACCOUNT_IDFlorida Water Company        20         1Power Company                75         1Phone Company                125        1Software Company             250        1Record Club                  25         2Cable TV Company             35         3Debtor's Credit Card         35         4U-O-Us Insurance Company     125        5Joe's Car Palace             350        5S.C. Student Loan            200        6</FONT></PRE><P>Now try to insert a record into the <TT>BILLS</TT> table that duplicates datathat already exists.</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">1&gt; <B>insert BILLS (NAME, AMOUNT, ACCOUNT_ID)</B>2&gt; <B>values(&quot;Power Company&quot;, 125, 1)</B>3&gt; <B>go</B></FONT></PRE><H5>ANALYSIS:</H5><P>You should have received an error message telling you that the <TT>INSERT</TT>command was not allowed. This type of error message can be trapped within an applicationprogram, and a message could tell the user he or she inserted invalid data.<H4><FONT COLOR="#000077">Example 10.3</FONT></H4><P>Create an index on the <TT>BILLS</TT> table that will sort the <TT>AMOUNT</TT>field in descending order.</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>CREATE INDEX DESC_AMOUNT</B>     <B>ON  BILLS(AMOUNT DESC);</B>Index created.</FONT></PRE><H5>ANALYSIS:</H5><P>This is the first time you have used the <TT>DESC</TT> operator, which tells SQLto sort the index in descending order. (By default a number field is sorted in ascendingorder.) Now you can examine your handiwork:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM BILLS;</B>NAME                         AMOUNT     ACCOUNT_IDJoe's Car Palace             350        5Software Company             250        1S.C. Student Loan            200        6Phone Company                125        1U-O-Us Insurance Company     125        5Power Company                75         1Cable TV Company             35         3Debtor's Credit Card         35         4Record Club                  25         2Florida Water Company        20         110 rows selected.</FONT></PRE><H5>ANALYSIS:</H5><P>This example created an index using the <TT>DESC</TT> operator on the column amount.Notice in the output that the amount is ordered from largest to smallest.<H3><FONT COLOR="#000077">Indexes and Joins</FONT></H3><P>When using complicated joins in queries, your <TT>SELECT</TT> statement can takea long time. With large tables, this amount of time can approach several seconds(as compared to the milliseconds you are used to waiting). This type of performancein a client/server environment with many users becomes extremely frustrating to theusers of your application. Creating an index on fields that are frequently used injoins can optimize the performance of your query considerably. However, if too manyindexes are created, they can slow down the performance of your system, rather thanspeed it up. We recommend that you experiment with using indexes on several largetables (on the order of thousands of records). This type of experimentation leadsto a better understanding of optimizing SQL statements.<BLOCKQUOTE>	<P><HR><FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>Most implementations have a mechanism	for gathering the elapsed time of a query; Oracle refers to this feature as timing.	Check your implementation for specific information. <HR></BLOCKQUOTE><P>The following example creates an index on the <TT>ACCOUNT_ID</TT> fields in the<TT>BILLS</TT> and <TT>BANK_ACCOUNTS</TT> tables:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>CREATE INDEX BILLS_INDEX ON BILLS(ACCOUNT_ID);</B>Index created.SQL&gt; <B>CREATE INDEX BILLS_INDEX2 ON BANK_ACCOUNTS(ACCOUNT_ID);</B>Index created.SQL&gt; <B>SELECT BILLS.NAME NAME, BILLS.AMOUNT AMOUNT, BANK_ACCOUNTS.BALANCE</B>  2  <B>ACCOUNT_BALANCE</B>  3 <B> FROM BILLS, BANK_ACCOUNTS</B>  4  <B>WHERE BILLS.ACCOUNT_ID = BANK_ACCOUNTS.ACCOUNT_ID;</B>NAME                         AMOUNT     ACCOUNT_BALANCEPhone Company                125        500Power Company                75         500Software Company             250        500Florida Water Company        20         500Record Club                  25         1200Cable TV Company             35         90Debtor's Credit Card         35         400Joe's Car Palace             350        2500U-O-Us Insurance Company     125        2500S.C. Student Loan            200        450010 rows selected.</FONT></PRE><H5>ANALYSIS:</H5><P>This example first created an index for the <TT>ACCOUNT_ID</TT> on both tablesin the associated query. By creating indexes for <TT>ACCOUNT_ID</TT> on each table,the join can more quickly access specific rows of data. As a rule, you should indexthe column(s) of a table that are unique or that you plan to join tables with inqueries.<H3><FONT COLOR="#000077">Using Clusters</FONT></H3><P>Although we originally said that indexes can be used to present a view of a tablethat is different from the existing physical arrangement, this statement is not entirelyaccurate. A special type of index supported by many database systems allows the databasemanager or developer to cluster data. When a clustered index is used, the physicalarrangement of the data within a table is modified. Using a clustered index usuallyresults in faster data retrieval than using a traditional, nonclustered index. However,many database systems (such as Sybase SQL Server) allow only one clustered indexper table. The field used to create the clustered index is usually the primary keyfield. Using Sybase Transact-SQL, you could create a clustered, unique index on the<TT>ACCOUNT_ID</TT> field of the <TT>BANK_ACCOUNTS</TT> table using the followingsyntax:</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">create unique clustered index id_indexon BANK_ACCOUNTS(ACCOUNT_ID) go</FONT></PRE><P>Oracle treats the concept of clusters differently. When using the Oracle relationaldatabase, a cluster is a database object like a database or table. A cluster is usedto store tables with common fields so that their access speed is improved.</P><P>Here is the syntax to create a cluster using Oracle7:</P><H5>SYNTAX:</H5><PRE><FONT COLOR="#0066FF">CREATE CLUSTER [schema.]cluster(column datatype [,column datatype] ... )[PCTUSED integer] [PCTFREE integer][SIZE integer [K|M] ][INITRANS integer] [MAXTRANS integer][TABLESPACE tablespace][STORAGE storage_clause][!!under!!INDEX| [HASH IS column] HASHKEYS integer]</FONT></PRE><P>You should then create an index within the cluster based on the tables that willbe added to it. Then you can add the tables. You should add tables only to clustersthat are frequently joined. Do not add tables to clusters that are accessed individuallythrough a simple <TT>SELECT</TT> statement.</P><P>Obviously, clusters are a very vendor-specific feature of SQL. We will not gointo more detail here on their use or on the syntax that creates them. However, consultyour database vendor's documentation to determine whether your database managementsystem supports these useful objects.<H2><FONT COLOR="#000077">Summary</FONT></H2><P>Views are virtual tables. Views are simply a way of presenting data in a formatthat is different from the way it actually exists in the database. The syntax ofthe <TT>CREATE VIEW</TT> statement uses a standard <TT>SELECT</TT> statement to createthe view (with some exceptions). You can treat a view as a regular table and performinserts, updates, deletes, and selects on it. We briefly discussed the use of databasesecurity and how views are commonly used to implement this security. Database securityis covered in greater detail on Day 12.</P><P>The basic syntax used to create a view is</P><PRE><FONT COLOR="#0066FF">CREATE VIEW view_name ASSELECT field_name(s) FROM table_name(s);</FONT></PRE><P>Here are the most common uses of views:<UL>	<LI>To perform user security functions	<P>	<LI>To convert units	<P>	<LI>To create a new virtual table format	<P>	<LI>To simplify the construction of complex queries</UL><P>Indexes are also database design and SQL programming tools. Indexes are physicaldatabase objects stored by your database management system that can be used to retrievedata already sorted from the database. In addition, thanks to the way indexes aremapped out, using indexes and properly formed queries can yield significant performanceimprovements.</P><P>The basic syntax used to create an index looks like this:</P><PRE><FONT COLOR="#0066FF">CREATE INDEX index_nameON table_name(field_name(s));</FONT></PRE><P>Some database systems include very useful additional options such as the <TT>UNIQUE</TT>and <TT>CLUSTERED</TT> keywords.<H2><FONT COLOR="#000077">Q&amp;A</FONT></H2><DL>	<DD><B>Q If the data within my table is already in sorted order, why should I use	an index on that table?</B>	<P><B>A</B> An index still gives you a performance benefit by looking quickly through	key values in a tree. The index can locate records faster than a direct access search	through each record within your database. Remember--the SQL query processor doesn't	necessarily know that your data is in sorted order.</P>	<P><B>Q Can I create an index that contains fields from multiple tables?</B></P>	<P><B>A</B> No, you cannot. However, Oracle7, for instance, allows you to create	a cluster. You can place tables within a cluster and create cluster indexes on fields	that are common to the tables. This implementation is the exception, not the rule,	so be sure to study your documentation on this topic in more detail.</DL><H2><FONT COLOR="#000077">Workshop</FONT></H2><P>The Workshop provides quiz questions to help solidify your understanding of thematerial covered, as well as exercises to provide you with experience in using whatyou have learned. Try to answer the quiz and exercise questions before checking theanswers in Appendix F, &quot;Answers to Quizzes and Exercises.&quot;<H3><FONT COLOR="#000077">Quiz</FONT></H3><DL>	<DD><B>1.</B> What will happen if a unique index is created on a nonunique field?	<P><B>2.</B> Are the following statements true or false?</P>	<P>Both views and indexes take up space in the database and therefore must be factored	in the planning of the database size.</P>	<P>If someone updates a table on which a view has been created, the view mus

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线成人av影院| 日韩精品一区二区三区在线播放| 久久嫩草精品久久久精品一| 色综合色综合色综合色综合色综合| 国产成人在线色| 久久不见久久见免费视频7| 日本在线播放一区二区三区| 丝袜美腿亚洲色图| 视频一区二区欧美| 男人的j进女人的j一区| 午夜精品爽啪视频| 日韩高清在线观看| 青青草97国产精品免费观看| 日精品一区二区三区| 男男gaygay亚洲| 日本成人在线视频网站| 久久99精品一区二区三区| 美美哒免费高清在线观看视频一区二区| 日本系列欧美系列| 麻豆专区一区二区三区四区五区| 亚洲成av人在线观看| 日本v片在线高清不卡在线观看| 亚洲一区二区欧美| 日韩av电影免费观看高清完整版 | 久久新电视剧免费观看| 91久久精品一区二区三| 欧美三级日韩在线| 欧美日韩免费在线视频| 日韩欧美一级片| 2024国产精品| 亚洲人一二三区| 亚洲精品日韩专区silk| 亚洲综合激情另类小说区| 婷婷综合久久一区二区三区| 日韩精品免费专区| 国产乱妇无码大片在线观看| 国产成人精品影院| 欧美视频日韩视频| 日韩欧美中文字幕公布| 欧美欧美午夜aⅴ在线观看| 精品毛片乱码1区2区3区| 色婷婷综合久久久| 成人的网站免费观看| 91麻豆精东视频| 欧美性大战久久| 欧美成人性战久久| 亚洲欧洲国产日本综合| 亚洲影视在线播放| 国产一区激情在线| 91丨九色丨尤物| 精品免费视频.| 18成人在线观看| 国内精品嫩模私拍在线| 从欧美一区二区三区| 欧美日韩综合不卡| 久久综合99re88久久爱| 国产欧美精品日韩区二区麻豆天美| 亚洲乱码国产乱码精品精的特点 | 欧美私模裸体表演在线观看| 欧美一级专区免费大片| 国产精品久久久久久久久久久免费看 | 亚洲欧美偷拍卡通变态| 免费观看久久久4p| 成人激情电影免费在线观看| 在线91免费看| 国产精品毛片a∨一区二区三区| 天堂va蜜桃一区二区三区| 国产一区二区三区最好精华液| 91久久精品日日躁夜夜躁欧美| 91精品国产免费| 亚洲国产精品精华液2区45| 另类欧美日韩国产在线| 91网站最新地址| 久久新电视剧免费观看| 午夜视频一区二区| 一本大道综合伊人精品热热| 精品噜噜噜噜久久久久久久久试看| 一区二区三区在线视频播放| 亚洲一区二区三区四区五区黄| 国产伦精品一区二区三区在线观看| 欧美性猛交xxxx黑人交 | 日韩欧美激情在线| 综合欧美亚洲日本| 精品一区二区免费看| 欧美日韩国产精品自在自线| 国产精品久久久久久久蜜臀| 亚洲a一区二区| 91福利在线免费观看| 久久久久久亚洲综合影院红桃| 秋霞电影一区二区| 91国产福利在线| 一区二区三区日韩欧美精品| 国产成a人亚洲| 久久久亚洲精华液精华液精华液| 亚洲一区视频在线观看视频| 国产91丝袜在线观看| 日韩精品自拍偷拍| 亚洲主播在线观看| 在线亚洲一区二区| 最近日韩中文字幕| 91视频国产资源| 中文字幕不卡在线观看| 成人一二三区视频| 国产亚洲精品bt天堂精选| 欧美视频在线播放| 成人av免费在线观看| 日韩一区二区三区视频在线| 亚洲精品高清视频在线观看| 成人国产亚洲欧美成人综合网| 国产午夜精品久久久久久久| 日本中文在线一区| 日韩一级二级三级精品视频| 亚洲成人综合网站| 678五月天丁香亚洲综合网| 亚洲一区二区偷拍精品| 欧美日韩一区高清| 视频一区中文字幕国产| 日本精品视频一区二区三区| 亚洲另类在线一区| av中文字幕不卡| 一区二区三区在线观看欧美| 99riav一区二区三区| 亚洲国产一区二区在线播放| 在线精品视频一区二区| 日韩av不卡在线观看| 日韩欧美一区中文| 韩国精品一区二区| 久久久精品tv| 99久久777色| 一区二区免费看| 欧美精品一级二级| 免费视频最近日韩| 国产女同性恋一区二区| 成人免费看黄yyy456| 亚洲卡通动漫在线| 欧美亚一区二区| 秋霞电影网一区二区| 久久久久久免费毛片精品| 一区二区三区美女| 日韩天堂在线观看| 激情图片小说一区| 中文字幕一区二区在线观看| 91麻豆文化传媒在线观看| 香港成人在线视频| 日韩精品专区在线| www.亚洲在线| 亚洲一本大道在线| 久久蜜桃av一区二区天堂| eeuss国产一区二区三区| 亚洲成人黄色影院| 精品区一区二区| 色综合久久88色综合天天| 天天色综合成人网| 中文字幕一区二区在线观看| 欧美日韩一卡二卡三卡| 国产成人午夜精品影院观看视频 | 亚洲免费观看高清完整版在线| 欧美一级免费大片| 国产大陆a不卡| 一区二区免费在线播放| 欧美嫩在线观看| 免费不卡在线观看| 亚洲免费观看视频| 精品国产人成亚洲区| 日本精品裸体写真集在线观看| 免费精品视频在线| 亚洲黄一区二区三区| 日韩精品最新网址| 欧美色精品天天在线观看视频| 国产一区二区三区免费观看| 亚洲电影一级黄| 国产欧美日韩卡一| 日韩免费高清电影| 91蜜桃视频在线| 国产suv一区二区三区88区| 亚洲国产精品久久艾草纯爱| 国产精品人成在线观看免费| 欧美喷潮久久久xxxxx| 色综合激情五月| 国产精一区二区三区| 欧美a一区二区| 亚洲视频每日更新| 国产欧美一区二区精品忘忧草| 欧美日韩免费一区二区三区视频 | 欧美精品日韩综合在线| 成人av免费在线| 国产99久久久久| 久久精品久久99精品久久| 亚洲高清在线视频| 中文字幕日本不卡| 国产精品无人区| 精品欧美乱码久久久久久1区2区| 欧美网站大全在线观看| 成人性生交大片免费看视频在线| 国产一区欧美二区| 麻豆久久久久久| 日韩av网站免费在线| 五月天亚洲婷婷| 性久久久久久久久久久久| 亚洲欧美电影院|