Exquisite SQL statement

xiaoxiao2021-03-06  56

Description: Replication table (only copy structure, source table name: a New table name: b) SQL: Select * INTO B from a where 1 <> 1 Description: Copy 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: Display article, author and last reply time sql: select a.title, a.username, B.Adddate from table A, (Select max) adddddate from table where table.title = a.title) B Description: Outer connection query (table name 1: a table name 2: b) SQL: SELECT AA, AB, AC, BC, BD , BF from a left out join b on aa = bc Description: Schedule 5 minutes ahead reminder SQL: SELECT * FROM schedule Arranging WHERE DATEDIFF ('minute', f Start time, getdate ())> 5 Description: Two association table , Delete information in the primary table, SQL: Delete from info pen 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 (to_char (sysdate, 'yyyy / mm') || '/ 01 ',' YYYY / MM / DD ') - 1,' YYYY / mm ')) y, where x.num = y. NVL (y.stock_onhand, 0) <> x.stock_onhand) B where a.num = B.NUM Description: - SQL: select * from studentinfo where not exists (select * from student where studentinfo.id = student.id) and department name = ' "& strdepartmentname &"' and professional name = ' "& strprofessionname &"' order by gender, students, the college entrance examination Total results Description: From the database to the annual telephone charge statistics (telephone bill Quota "Source) SQL: Select A.Userper, a.tel, a.standfee, to_char (a.telfeedate, ' YYYY '

转载请注明原文地址:https://www.9cbs.com/read-114585.html

New Post(0)