1. Description: Copy table (copy structure only, source table name: A new table name: b)
Sql:select * to B from a where 1<>1
2. Description: Copy table (copy data, source table name: A target table name: b)
Sql:insert to B (A, B, c) select d,e,f from B;
3. Description: Displays the article, the author and the last reply time
Sql:select a.title,a.username,b.adddate from Table A, (select Max (adddate) adddate from table where Table.title=a.title) b
4. Description: Outer join query (table name 1:a table name 2:b)
Sql:select a.a, A.B, A.C, B.C, B.D, B.f from a left OUTER JOIN b on a.a = B.C
5. Description: Schedule five minutes advance reminder
Sql:select * from schedule where DateDiff (' minute ', F start time, GETDATE ()) >5
6. Description: Two related tables, delete information in the primary table that is not already in the secondary table
Sql:
Delete from info where NOT EXISTS (SELECT * from Infobz where Info.infid=infobz.infid)
Description:--
Sql:
SELECT A.num, A.name, B.upd_date, b.prev_upd_date
From TABLE1,
(SELECT x.num, x.upd_date, Y.upd_date prev_upd_date
From (SELECT NUM, Upd_date, Inbound_qty, Stock_onhand
From TABLE2
WHERE to_char (upd_date, ' yyyy/mm ') = To_char (sysdate, ' yyyy/mm ')) X,
(SELECT NUM, Upd_date, Stock_onhand
From TABLE2
WHERE to_char (upd_date, ' yyyy/mm ') =
To_char (To_date (To_char (sysdate, ' yyyy/mm ') | | '/01 ', ' Yyyy/mm/dd ')-1, ' yyyy/mm ') Y,
http://www.bkjia.com/PHPjc/630993.html www.bkjia.com true http://www.bkjia.com/PHPjc/630993.html techarticle 1. Description: Copy table (copy structure only, source table name: A new table name: b) Sql:select * into B from a where 1 1 2. Description: Copy table (copy data, source table name: A target table name: b) Sql:inser ...