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

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

?? ch10.htm

?? Learn SQL in an easy way...
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
the view. From that point on, you can select records from the view and already havethe total amount calculated for you. The statement would look like this:</P><H5>INPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>CREATE VIEW LATE_PAYMENT (NAME, NEW_TOTAL, ACCOUNT_TYPE) AS</B>  2  <B>SELECT BILLS.NAME, BILLS.AMOUNT * 1.10, BANK_ACCOUNTS.TYPE</B>  3  <B>FROM BILLS, BANK_ACCOUNTS</B>  4  <B>WHERE BILLS.ACCOUNT_ID = BANK_ACCOUNTS.ACCOUNT_ID;</B></FONT></PRE><H5><FONT COLOR="#000000">OUTPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">View created.</FONT></PRE><H5><FONT COLOR="#000000">INPUT/OUTPUT:</FONT></H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM LATE_PAYMENT;</B>NAME                         NEW_TOTAL     ACCOUNT_TYPEPhone Company                137.50        CheckingPower Company                82.50         CheckingRecord Club                  27.50         Money MarketSoftware Company             275           CheckingCable TV Company             38.50         CheckingJoe's Car Palace             385           CheckingS.C. Student Loan            220           BusinessFlorida Water Company        22            CheckingU-O-Us Insurance Company     137.50        BusinessDebtor's Credit Card         38.50         Savings10 rows selected.</FONT></PRE><H3><FONT COLOR="#000077">Restrictions on Using SELECT</FONT></H3><P>SQL places certain restrictions on using the <TT>SELECT</TT> statement to formulatea view. The following two rules apply when using the <TT>SELECT</TT> statement:<UL>	<LI>You cannot use the <TT>UNION</TT> operator.</UL><UL>	<LI>You cannot use the <TT>ORDER BY</TT> clause. However, you can use the <TT>GROUP	BY</TT> clause in a view to perform the same functions as the <TT>ORDER BY</TT> clause.</UL><H3><FONT COLOR="#000077">Modifying Data in a View</FONT></H3><P>As you have learned, by creating a view on one or more physical tables withina database, you can create a virtual table for use throughout an SQL script or adatabase application. After the view has been created using the <TT>CREATE VIEW...SELECT</TT>statement, you can update, insert, or delete view data using the <TT>UPDATE</TT>,<TT>INSERT</TT>, and <TT>DELETE</TT> commands you learned about on Day 8, &quot;ManipulatingData.&quot;</P><P>We discuss the limitations on modifying a view's data in greater detail later.The next group of examples illustrates how to manipulate data that is in a view.</P><P>To continue on the work you did in Example 10.2, update the <TT>BILLS</TT> tableto reflect that unfortunate 10 percent late charge.</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>CREATE VIEW LATE_PAYMENT AS</B>  2  <B>SELECT * FROM BILLS;</B>View created.SQL&gt; <B>UPDATE LATE_PAYMENT</B>  2  <B>SET AMOUNT = AMOUNT * 1.10;</B>1 row updated.SQL&gt;  <B>SELECT * FROM LATE_PAYMENT;</B>NAME                         NEW_TOTAL     ACCOUNT_IDPhone Company                137.50        1Power Company                82.50         1Record Club                  27.50         2Software Company             275           1Cable TV Company             38.50         3Joe's Car Palace             385           5S.C. Student Loan            220           6Florida Water Company        22            1U-O-Us Insurance Company     137.50        5Debtor's Credit Card         38.50         410 rows selected.</FONT></PRE><P>To verify that the <TT>UPDATE</TT> actually updated the underlying table, <TT>BILLS</TT>,query the <TT>BILLS</TT> table:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>SELECT * FROM BILLS;</B>NAME                         NEW_TOTAL     ACCOUNT_IDPhone Company                137.50        1Power Company                82.50         1Record Club                  27.50         2Software Company             275           1Cable TV Company             38.50         3Joe's Car Palace             385           5S.C. Student Loan            220           6Florida Water Company        22            1U-O-Us Insurance Company     137.50        5Debtor's Credit Card         38.50         410 rows selected.</FONT></PRE><P>Now delete a row from the view:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>DELETE FROM LATE_PAYMENT</B>  2  <B> WHERE ACCOUNT_ID = 4;</B>1 row deleted.SQL&gt; <B>SELECT * FROM LATE_PAYMENT;</B>NAME                         NEW_TOTAL     ACCOUNT_IDPhone Company                137.50        1Power Company                82.50         1Record Club                  27.50         2Software Company             275           1Cable TV Company             38.50         3Joe's Car Palace             385           5S.C. Student Loan            220           6Florida Water Company        22            1U-O-Us Insurance Company     137.50        59 rows selected.</FONT></PRE><P>The final step is to test the <TT>UPDATE</TT> function. For all bills that havea <TT>NEW_TOTAL</TT> greater than <TT>100</TT>, add an additional <TT>10</TT>.</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>UPDATE LATE_PAYMENT</B>  2  <B>SET NEW_TOTAL = NEW_TOTAL + 10</B>  3  <B>WHERE NEW_TOTAL &gt; 100;</B>9 rows updated.SQL&gt; <B>SELECT * FROM LATE_PAYMENT;</B>NAME                         NEW_TOTAL     ACCOUNT_IDPhone Company                147.50        1Power Company                82.50         1Record Club                  27.50         2Software Company             285           1Cable TV Company             38.50         3Joe's Car Palace             395           5S.C. Student Loan            230           6Florida Water Company        22            1U-O-Us Insurance Company     147.50        59 rows selected.</FONT></PRE><H3><FONT COLOR="#000077">Problems with Modifying Data Using Views</FONT></H3><P>Because what you see through a view can be some set of a group of tables, modifyingthe data in the underlying tables is not always as straightforward as the previousexamples. Following is a list of the most common restrictions you will encounterwhile working with views:<UL>	<LI>You cannot use <TT>DELETE</TT> statements on multiple table views.	<P>	<LI>You cannot use the <TT>INSERT</TT> statement unless all <TT>NOT NULL</TT> columns	used in the underlying table are included in the view. This restriction applies because	the SQL processor does not know which values to insert into the <TT>NOT NULL</TT>	columns.	<P>	<LI>If you do insert or update records through a join view, all records that are	updated must belong to the same physical table.	<P>	<LI>If you use the <TT>DISTINCT</TT> clause to create a view, you cannot update or	insert records within that view.	<P>	<LI>You cannot update a virtual column (a column that is the result of an expression	or function).</UL><H3><FONT COLOR="#000077">Common Applications of Views</FONT></H3><P>Here are a few of the tasks that views can perform:<UL>	<LI>Providing user security functions	<P>	<LI>Converting between units	<P>	<LI>Creating a new virtual table format	<P>	<LI>Simplifying the construction of complex queries</UL><H3><FONT COLOR="#000077">Views and Security</FONT></H3><P>Although a complete discussion of database security appears in Day 12, &quot;DatabaseSecurity,&quot; we briefly touch on the topic now to explain how you can use viewsin performing security functions.</P><P>All relational database systems in use today include a full suite of built-insecurity features. Users of the database system are generally divided into groupsbased on their use of the database. Common group types are database administrators,database developers, data entry personnel, and public users. These groups of usershave varying degrees of privileges when using the database. The database administratorwill probably have complete control of the system, including <TT>UPDATE</TT>, <TT>INSERT</TT>,<TT>DELETE</TT>, and <TT>ALTER</TT> database privileges. The public group may begranted only <TT>SELECT</TT> privileges--and perhaps may be allowed to <TT>SELECT</TT>only from certain tables within certain databases.</P><P>Views are commonly used in this situation to control the information that thedatabase user has access to. For instance, if you wanted users to have access onlyto the <TT>NAME</TT> field of the <TT>BILLS</TT> table, you could simply create aview called <TT>BILLS_NAME</TT>:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt;  <B>CREATE VIEW BILLS_NAME AS</B>  2   SELECT NAME FROM BILLS;View created.</FONT></PRE><P>Someone with system administrator-level privileges could grant the public group<TT>SELECT</TT> privileges on the <TT>BILLS_NAME</TT> view. This group would nothave any privileges on the underlying <TT>BILLS</TT> table. As you might guess, SQLhas provided data security statements for your use also. Keep in mind that viewsare very useful for implementing database security.<H3><FONT COLOR="#000077">Using Views to Convert Units</FONT></H3><P>Views are also useful in situations in which you need to present the user withdata that is different from the data that actually exists within the database. Forinstance, if the <TT>AMOUNT</TT> field is actually stored in U.S. dollars and youdon't want Canadian users to have to continually do mental calculations to see the<TT>AMOUNT</TT> total in Canadian dollars, you could create a simple view called<TT>CANADIAN_BILLS</TT>:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt;  <B>CREATE VIEW CANADIAN_BILLS (NAME, CAN_AMOUNT) AS</B>  2   <B>SELECT NAME, AMOUNT / 1.10</B>  3   <B>FROM BILLS;</B>View Created.SQL&gt; <B>SELECT * FROM CANADIAN_BILLS;</B>NAME                         CAN_AMOUNTPhone Company                125Power Company                75Record Club                  25Software Company             250Cable TV Company             35Joe's Car Palace             350S.C. Student Loan            200Florida Water Company        20U-O-Us Insurance Company     1259 rows selected.</FONT></PRE><H5>ANALYSIS:</H5><P>When converting units like this, keep in mind the possible problems inherent inmodifying the underlying data in a table when a calculation (such as the precedingexample) was used to create one of the columns of the view. As always, you shouldconsult your database system's documentation to determine exactly how the systemimplements the <TT>CREATE VIEW</TT> command.<H3><FONT COLOR="#000077">Simplifying Complex Queries Using Views</FONT></H3><P>Views are also useful in situations that require you to perform a sequence ofqueries to arrive at a result. The following example illustrates the use of a viewin this situation.</P><P>To give the name of all banks that sent bills to the state of Texas with an amountless than <TT>$50</TT>, you would break the problem into two separate problems:<UL>	<LI>Retrieve all bills that were sent to Texas</UL><UL>	<LI>Retrieve all bills less than <TT>$50</TT></UL><P>Let's solve this problem using two separate views: <TT>BILLS_1</TT> and <TT>BILLS_2</TT>:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>CREATE TABLE BILLS1 AS</B>  2  <B>SELECT * FROM BILLS</B>  3  <B>WHERE AMOUNT &lt; 50;</B>Table created.SQL&gt; <B>CREATE TABLE BILLS2 (NAME, AMOUNT, ACCOUNT_ID) AS</B>  2  <B>SELECT BILLS.* FROM BILLS, COMPANY</B>  3  <B>WHERE BILLS.NAME = COMPANY.NAME AND COMPANY.STATE = &quot;TX&quot;;</B>Table created.</FONT></PRE><H5>ANALYSIS:</H5><P>Because you want to find all bills sent to Texas and all bills that were lessthan <TT>$50</TT>, you can now use the SQL <TT>IN</TT> clause to find which billsin <TT>BILLS1</TT> were sent to Texas. Use this information to create a new viewcalled <TT>BILLS3</TT>:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt;<B> CREATE VIEW BILLS3 AS</B>  2  <B>SELECT * FROM BILLS2 WHERE NAME IN</B>  3 <B> (SELECT * FROM BILLS1);</B>View created.</FONT></PRE><P>Now combine the preceding query with the <TT>BANK_ACCOUNTS</TT> table to satisfythe original requirements of this example:</P><H5>INPUT/OUTPUT:</H5><PRE><FONT COLOR="#0066FF">SQL&gt; <B>CREATE VIEW BANKS_IN_TEXAS (BANK) AS</B>  2  <B>SELECT BANK_ACCOUNTS.BANK</B>  3  <B>FROM BANK_ACCOUNTS, BILLS3</B>  4  <B>WHERE BILLS3.ACCOUNT_ID = BANK_ACCOUNTS.ACCOUNT_ID;</B>View created.SQL&gt; <B>SELECT * FROM BANK_IN_TEXAS;</B>BANKCredit Union1 row selected.</FONT></PRE><P><H5><FONT COLOR="#0066FF"></FONT></H5><H5>ANALYSIS:</H5><P>As you can see, after the queries were broken down into separate views, the finalquery was rather simple. Also, you can reuse the individual views as often as necessary.<H3><FONT COLOR="#000077">The DROP VIEW Statement</FONT></H3>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲一区二区三区四区 | 久久精品国产澳门| 欧美这里有精品| 亚洲综合一区在线| 这里是久久伊人| 久久99国产精品久久| 久久久久国色av免费看影院| 成人国产视频在线观看| 中文字幕日韩欧美一区二区三区| 色综合天天综合在线视频| 亚洲香蕉伊在人在线观| 在线成人av影院| 国产中文字幕一区| 亚洲免费色视频| 欧美电影一区二区| 久久99久国产精品黄毛片色诱| 国产亚洲一区二区三区| 91在线观看成人| 爽好久久久欧美精品| 国产欧美日韩激情| 色噜噜偷拍精品综合在线| 蜜臀av性久久久久av蜜臀妖精| 久久午夜羞羞影院免费观看| 972aa.com艺术欧美| 丝瓜av网站精品一区二区| 欧美激情一区二区三区全黄| 欧美亚洲另类激情小说| 韩日av一区二区| 亚洲国产综合在线| 国产日产欧美精品一区二区三区| 在线亚洲一区二区| 国产在线一区二区| 夜夜嗨av一区二区三区| 26uuu久久综合| 欧美性xxxxx极品少妇| 国产精品亚洲专一区二区三区| 亚洲国产精品尤物yw在线观看| 精品国产乱码久久久久久蜜臀| 91首页免费视频| 久久超级碰视频| 一区二区高清免费观看影视大全| 久久久久一区二区三区四区| 欧美日韩精品专区| 一本一本大道香蕉久在线精品| 久99久精品视频免费观看| 亚洲亚洲人成综合网络| 中文久久乱码一区二区| 日韩欧美国产一区在线观看| 在线观看不卡一区| 99精品黄色片免费大全| 国产一区二区三区四| 日韩精品一区第一页| 亚洲激情自拍偷拍| 国产精品毛片a∨一区二区三区| 精品国产污网站| 91精品国产综合久久精品| 欧美亚洲国产怡红院影院| www.爱久久.com| 成人激情小说网站| 国产精品一区二区在线播放| 日本不卡一二三| 日韩精品一二三| 亚洲bdsm女犯bdsm网站| 亚洲免费视频成人| 18成人在线观看| 国产精品久久99| 国产精品无人区| 中文在线资源观看网站视频免费不卡| 日韩欧美国产午夜精品| 日韩精品一区二区三区四区视频| 欧美日韩国产一二三| 欧美性生交片4| 欧美色综合天天久久综合精品| 色诱视频网站一区| 一本到高清视频免费精品| 91在线观看视频| 色噜噜久久综合| 欧美另类z0zxhd电影| 欧美日韩在线不卡| 欧美午夜电影网| 欧美视频一区二区三区| 欧美乱熟臀69xxxxxx| 91精品福利在线一区二区三区| 91精品欧美久久久久久动漫| 日韩午夜精品视频| 精品国产成人系列| 国产精品天美传媒| 一区二区三区在线视频免费观看| 亚洲国产欧美在线| 日本一不卡视频| 国产老女人精品毛片久久| 国产寡妇亲子伦一区二区| 处破女av一区二区| 97久久精品人人爽人人爽蜜臀| 97精品超碰一区二区三区| 91黄色小视频| 日韩精品在线网站| 国产精品欧美一级免费| 亚洲一区二区影院| 麻豆中文一区二区| 成人av免费观看| 欧美性一区二区| 欧美精品一区二区三区蜜桃| 久久久久久一二三区| 亚洲免费色视频| 日韩国产欧美在线视频| 国产传媒久久文化传媒| 日本高清免费不卡视频| 日韩视频在线你懂得| 国产日韩欧美高清| 亚洲国产一区视频| 国产精品99久久久久久宅男| 色噜噜狠狠一区二区三区果冻| 欧美一卡2卡3卡4卡| 欧美精彩视频一区二区三区| 亚洲一区二区三区在线播放| 91麻豆成人久久精品二区三区| 欧美午夜精品免费| 久久精品视频免费观看| 亚洲成人激情av| 国产成人aaaa| 欧美一区二区不卡视频| ...xxx性欧美| 国产在线一区观看| 欧美日韩亚洲另类| 国产精品你懂的在线欣赏| 午夜精品在线视频一区| 成人avav影音| 欧美mv日韩mv| 亚洲成人先锋电影| jlzzjlzz亚洲日本少妇| 日韩一级视频免费观看在线| 亚洲欧美综合网| 国产一区二区三区久久久| 欧美亚洲综合久久| 亚洲欧洲韩国日本视频| 国产一级精品在线| 51精品国自产在线| 亚洲精品一二三四区| 国产麻豆成人传媒免费观看| 欧美欧美午夜aⅴ在线观看| 亚洲欧美另类综合偷拍| 国产v日产∨综合v精品视频| 9191国产精品| 亚洲黄色片在线观看| 国产suv精品一区二区三区| 欧美www视频| 蜜臀av性久久久久av蜜臀妖精| 欧美在线观看一区| 亚洲人成在线播放网站岛国| 久久午夜色播影院免费高清| 精品在线播放免费| 久久久精品tv| 欧美亚男人的天堂| av电影在线观看一区| 亚洲色图制服丝袜| 国产成人aaaa| 日韩av中文字幕一区二区| 在线观看不卡视频| 一区二区三区在线免费观看| 不卡大黄网站免费看| 国产日韩精品一区二区三区| 久久99精品国产麻豆不卡| 欧美一区二区三区四区高清 | 国产高清不卡二三区| 久久综合色8888| 国产一区二区在线视频| 久久免费美女视频| 国产一区二区女| 国产欧美精品一区二区色综合朱莉 | 日韩欧美国产午夜精品| 91蜜桃在线免费视频| 精品国产露脸精彩对白 | 欧美一级一区二区| 日韩成人av影视| 一区视频在线播放| www.66久久| 亚洲综合精品久久| 51久久夜色精品国产麻豆| 免费视频一区二区| www久久久久| 成人爱爱电影网址| 亚洲蜜桃精久久久久久久| 在线观看区一区二| 婷婷中文字幕一区三区| 日韩无一区二区| 国产精品综合久久| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 日韩精品91亚洲二区在线观看| 欧美一区二区三区精品| 激情丁香综合五月| 亚洲天堂成人网| 欧美一区二区视频观看视频 | 成人午夜又粗又硬又大| 亚洲视频 欧洲视频| 777欧美精品| 国产91丝袜在线播放0| 亚洲欧美偷拍卡通变态| 678五月天丁香亚洲综合网| 国产一区二区美女|