⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectstatement.htm

📁 Absolute Database 5.12 src. Absolute Database lets you forget the Borland Database Engine (BDE). Th
💻 HTM
📖 第 1 页 / 共 4 页
字号:
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Courier New; font-size:8pt; color:#000000"></span></td></tr></table><span style="font-family:Courier New; font-size:8pt; color:#000000">
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>UNION Clause
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000"><b>
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">The UNION clause allows you to combine two or more queries into one result set that contains all of the unique records in all of the queries belonging to the union. 
<br>
The ALL keyword dictates that no duplicate records are removed, otherwise all duplicate records are removed. 
<br>
In comparison, a JOIN combines fields while a UNION combines records.
<br>
</span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000">
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>Example:
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000">
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000"></span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">SELECT&nbsp;Event_Name&nbsp;FROM&nbsp;events&nbsp;WHERE&nbsp;VenueNo&nbsp;&lt;&nbsp;3
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Courier New; font-size:8pt; color:#000000">UNION
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Courier New; font-size:8pt; color:#000000">SELECT&nbsp;Event_Name&nbsp;FROM&nbsp;events&nbsp;WHERE&nbsp;VenueNo&nbsp;&gt;&nbsp;8
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Courier New; font-size:8pt; color:#000000"></span></td></tr></table><span style="font-family:Courier New; font-size:8pt; color:#000000">
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>INTERSECT Clause
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000"><b>
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">The INTERSECT operator computes the set intersection of the rows returned by the involved SELECT statements. A row is in the intersection of two result sets if it appears in both result sets. 
<br>
The result of INTERSECT does not contain any duplicate rows unless the ALL option is specified. With ALL, a row that has m duplicates in the left table and n duplicates in the right table will appear min(m,n) times in the result set. 
<br>
Multiple INTERSECT operators in the same SELECT statement are evaluated left to right, unless parentheses dictate otherwise. INTERSECT binds more tightly than UNION. That is, A UNION B INTERSECT C will be read as A UNION (B INTERSECT C). 
<br>
</span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000">
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>Example:
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000">
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000"></span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">SELECT&nbsp;VenueNo&nbsp;FROM&nbsp;Venues
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Courier New; font-size:8pt; color:#000000">INTERSECT&nbsp;CORRESPONDING&nbsp;BY&nbsp;(VenueNo)
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Courier New; font-size:8pt; color:#000000">SELECT&nbsp;VenueNo&nbsp;FROM&nbsp;Events
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Courier New; font-size:8pt; color:#000000"></span></td></tr></table><span style="font-family:Courier New; font-size:8pt; color:#000000">
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>EXCEPT Clause
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000"><b>
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">The EXCEPT operator computes the set of rows that are in the result of the left SELECT statement but not in the result of the right one. 
<br>
The result of EXCEPT does not contain any duplicate rows unless the ALL option is specified. With ALL, a row that has m duplicates in the left table and n duplicates in the right table will appear max(m-n,0) times in the result set. 
<br>
Multiple EXCEPT operators in the same SELECT statement are evaluated left to right, unless parentheses dictate otherwise. EXCEPT binds at the same level as UNION.
<br>
</span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000">
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>Example:
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000">
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000"></span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">SELECT&nbsp;VenueNo&nbsp;FROM&nbsp;Venues
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Courier New; font-size:8pt; color:#000000">EXCEPT&nbsp;CORRESPONDING&nbsp;BY&nbsp;(VenueNo)
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Courier New; font-size:8pt; color:#000000">SELECT&nbsp;VenueNo&nbsp;FROM&nbsp;Events
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Courier New; font-size:8pt; color:#000000"></span></td></tr></table><span style="font-family:Courier New; font-size:8pt; color:#000000">
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>ORDER BY Clause
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000"><b>
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">The ORDER BY clause is used to sort the records returned by the SELECT query. The sort is based upon one or more selected fields contained in the records. Optionally one may add the key word ASC (ascending) or DESC (descending) after any expression in the ORDER BY clause. If not specified, ASC is assumed by default. 
<br>
Subqueries cannot include an ORDER BY. 
<br>
</span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000">
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>Example:
<br>
</b></span><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000">
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Helvetica,Arial; font-size:4pt; color:#000000"></span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">SELECT&nbsp;Event_Name,&nbsp;Venue,&nbsp;Ticket_Price&nbsp;FROM&nbsp;Events&nbsp;e,&nbsp;Venues&nbsp;v&nbsp;WHERE&nbsp;e.VenueNo&nbsp;=&nbsp;v.VenueNo&nbsp;ORDER&nbsp;BY&nbsp;Ticket_Price&nbsp;ASC,&nbsp;Venue&nbsp;DESC</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
&nbsp;<br>
</span></td></tr></table><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td width="14"></td><td><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"></span></span></td></tr></table>

<!--#include virtual="/inc/footer.php"--> 
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -