Some common SQL statements are provided below. They are all classic statements. Now I want to add them to my blog space and share them with you.
Some common SQL statements are provided below. They are all classic statements. Now I want to add them to my blog space and share them with you.
Some common SQL statements are provided below. They are all classic statements. Now I want to add them to my blog space and share them with you.
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
Software Development Network
Note: Five minutes in advance of the schedule
Software Development Network
SQL: select * from Schedule where datediff ('minute ', f Start Time, getdate ()> 5
Note: Two associated tables are used to delete information that is not available in the secondary table.
SQL:
Delete from info where not exists (select * from infobz where info. infid = infobz. infid)
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 ') interval between '/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
SQL:
Select * from studentinfo where not exists (select * from student where studentinfo. id = student. id) and Department name = '"& strdepartmentname &"' and major name = '"& strinclusionname &" 'order by gender, student source, total score of the College Entrance Examination