SQL¸ßÊÖƪ:¾«ÃîSQLÓï¾ä½éÉÜ
˵Ã÷£º¸´ÖƱí(Ö»¸´Öƽṹ,Ô´±íÃû£ºa бíÃû£ºb)
¡¡¡¡SQL: select * into b from a where 1<>1 ¡¡¡¡
¡¡¡¡ËµÃ÷£º¿½±´±í(¿½±´Êý¾Ý,Ô´±íÃû£ºa Ä¿±ê±íÃû£ºb)
¡¡¡¡SQL: insert into b(a, b, c) select d,e,f from b; ¡¡¡¡
¡¡¡¡ËµÃ÷£ºÏÔʾÎÄÕ¡¢Ìá½»È˺Í×îºó»Ø¸´Ê±¼ä
¡¡¡¡SQL: select a.title,a.username,b.adddate from table a,(select max(adddate) adddate from table where table.title=a.title) b ¡¡
¡¡¡¡ËµÃ÷£ºÍâÁ¬½Ó²éѯ(±íÃû1£ºa ±íÃû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 ¡¡¡¡
¡¡¡¡ËµÃ÷£ºÈճ̰²ÅÅÌáÇ°Îå·ÖÖÓÌáÐÑ
¡¡¡¡SQL: select * from Èճ̰²ÅÅ where datediff('minute',f¿ªÊ¼Ê±¼ä,getdate())>5 ¡¡¡¡
¡¡¡¡ËµÃ÷£ºÁ½ÕŹØÁª±í£¬É¾³ýÖ÷±íÖÐÒѾÔÚ¸±±íÖÐûÓеÄÐÅÏ¢
¡¡¡¡SQL:
¡¡¡¡delete from info where not exists ( select * from infobz where info.infid=infobz.infid ) ¡¡¡¡
¡¡¡¡ËµÃ÷£º--
¡¡¡¡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, WHERE X.NUM = Y.NUM £¨+£©AND X.INBOUND_QTY + NVL(Y.STOCK_ONHAND,0) <> X.STOCK_ONHAND ) B WHERE A.NUM = B.NUM ¡¡¡¡
¡¡¡¡ËµÃ÷£º--
¡¡¡¡SQL:
¡¡¡¡select * from studentinfo where not exists(select * from student where studentinfo.id=student.id) and ϵÃû³Æ='"&strdepartmentname&"' and רҵÃû³Æ='"&strprofessionname&"' order by ÐÔ±ð,ÉúÔ´µØ,¸ß¿¼×ܳɼ¨