Note: copy a table (only copy structure, source table name: a new table name: B)
SQL: Select * into B from a where 1 <> 1
Description: copy a table (copy data, source table name: A target table name: B)
SQL: insert into B (a, B, c) Select D, E, F from B;
Description: displays the article, Submitter, and 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
Description: External join query (table name 1: Table A name 2: B)
SQL: select a. a, a. B, A. C, B. C, B. D, B. F from a left out join B on A. A = B. C
Note: Five minutes in advance of the schedule
SQL: Select * from Schedule where datediff ('minute ', F Start Time, getdate ()> 5
Note: Two associated tables are used to delete information that is already unavailable to the primary table in the secondary table.
SQL:
Delete from info where not exists (select * From infobz where info. INFID = infobz. INFID)
Note :--
SQL:
Select. num,. 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') then comment '/01 ', 'yyyy/MM/dd')-1, 'yyyy/mm') y, where X. num = y. num (+) and X. inbound_qty + nvl (Y. stock_onhand, 0) <> X. stock_onhand) B where. num = B. num
Note :--
SQL:
Select * From studentinfo where not exists (select * from student where studentinfo. ID = student. ID)
And system name = '"& strdepartmentname &"' and professional name = '"& strinclusionname &" 'order by gender, student source, total score for college entrance examination