Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

һЩ²»´íµÄsqlÓï¾ä

1¡¢ËµÃ÷£º¸´ÖƱí(Ö»¸´Öƽṹ,Ô´±íÃû£ºa бíÃû£ºb) (Access¿ÉÓÃ)
·¨Ò»£ºselect * into b from a where 1<>1
·¨¶þ£ºselect top 0 * into b from a
2¡¢ËµÃ÷£º¿½±´±í(¿½±´Êý¾Ý,Ô´±íÃû£ºa Ä¿±ê±íÃû£ºb) (Access¿ÉÓÃ)
insert into b(a, b, c) select d,e,f from b;
3¡¢ËµÃ÷£º¿çÊý¾Ý¿âÖ®¼ä±íµÄ¿½±´(¾ßÌåÊý¾ÝʹÓþø¶Ô·¾¶) (Access¿ÉÓÃ)
insert into b(a, b, c) select d,e,f from b in ‘¾ßÌåÊý¾Ý¿â’    where Ìõ¼þ
Àý×Ó£º..from b in '"&Server.MapPath(".")&"\data.mdb" &"' where..
4¡¢ËµÃ÷£º×Ó²éѯ(±íÃû1£ºa ±íÃû2£ºb)
select a,b,c from a where a IN (select d from b )    »òÕß:    select a,b,c from a where a IN (1,2,3)
5¡¢ËµÃ÷£ºÏÔʾÎÄÕ¡¢Ìá½»È˺Í×îºó»Ø¸´Ê±¼ä
select a.title,a.username,b.adddate from table a,(select max(adddate) adddate from table where table.title=a.title) b
6¡¢ËµÃ÷£ºÍâÁ¬½Ó²éѯ(±íÃû1£ºa ±íÃû2£ºb)
select a.a, a.b, a.c, b.c, b.d, b.f from a LEFT OUT JOIN b ON a.a = b.c
7¡¢ËµÃ÷£ºÔÚÏßÊÓͼ²éѯ(±íÃû1£ºa )
select * from (SELECT a,b,c from a) T where t.a > 1;
8¡¢ËµÃ÷£ºbetweenµÄÓ÷¨,betweenÏÞÖƲéѯÊý¾Ý·¶Î§Ê±°üÀ¨Á˱߽çÖµ,not between²»°üÀ¨
select * from table1 where time between time1 and time2
select a,b,c, from table1 where a not between ÊýÖµ1 and ÊýÖµ2
9¡¢ËµÃ÷£ºin µÄʹÓ÷½·¨
select * from table1 where a [not] in (‘Öµ1’,’Öµ2’,’Öµ4’,’Öµ6’)
10¡¢ËµÃ÷£ºÁ½ÕŹØÁª±í£¬É¾³ýÖ÷±íÖÐÒѾ­ÔÚ¸±±íÖÐûÓеÄÐÅÏ¢
delete from table1 where not exists ( select * from table2 where table1.field1=table2.field1 )
11¡¢ËµÃ÷£ºËıíÁª²éÎÊÌ⣺
select * from a left inner join b on a.a=b.b right inner join c on a.a=c.c inner join d on a.a=d.d where .....
12¡¢ËµÃ÷£ºÈճ̰²ÅÅÌáÇ°Îå·ÖÖÓÌáÐÑ
SQL: select * from Èճ̰²ÅÅ where datediff('minute',f¿ªÊ¼Ê±¼ä,getdate())>5
13¡¢ËµÃ÷£ºÒ»Ìõsql Óï¾ä¸ã¶¨Êý¾Ý¿â·ÖÒ³
select top 10 b.* from (select top 20 Ö÷¼ü×Ö¶Î,ÅÅÐò×ֶΠfrom ±íÃû order by ÅÅÐò×ֶΠdesc) a,±íÃû b where b.Ö÷¼ü×ֶΠ= a.Ö÷¼ü×ֶΠorder by a.ÅÅÐò×Ö¶Î
14¡¢ËµÃ÷£ºÇ°10Ìõ¼Ç¼
select top 10 * for


Ïà¹ØÎĵµ£º

MS SQL ServerºÍMySQLÇø±ð

1 MySQLÖ§³Öenum,ºÍsetÀàÐÍ£¬SQL Server²»Ö§³Ö
¡¡¡¡2 MySQL²»Ö§³Önchar,nvarchar,ntextÀàÐÍ
¡¡¡¡3 MySQLµÄµÝÔöÓï¾äÊÇAUTO_INCREMENT£¬¶øMS SQLÊÇidentity(1,1)
¡¡¡¡4 MS SQLĬÈϵ½´¦±í´´½¨Óï¾äµÄĬÈÏÖµ±íʾÊÇ((0)),¶øÔÚMySQLÀïÃæÊDz»ÔÊÐí´øÁ½À¨ºÅµÄ
¡¡¡¡5 MySQLÐèҪΪ±íÖ¸¶¨´æ´¢ÀàÐÍ
¡¡¡¡6 MS SQLʶ±ð·ûÊÇ[],[type]±íÊ ......

SQLÖ®¾Å Êý¾Ý¿âÉè¼Æ

Íâ¼ü
======================
Íâ¼üÊÇÏà¶ÔÓÚÖ÷¼ü˵µÄ£¬Êǽ¨Á¢±íÖ®¼ä µÄÁªÏµµÄ±ØÐëµÄÇ°Ìá¡£
   ±ÈÈ磺ѧÉú±í ¡¢Ñ§Éú³É¼¨±íÒ»Ò»¶ÔÓ¦ÊÇÒòΪ ËûÃǶ¼¾ßÓÐÏàͬµÄ×ֶΣºÑ§ºÅ£¬°ÑѧÉú±í×÷ΪÖ÷±í£¬Ñ§ºÅÊÇËûµÄÖ÷¼ü£¬Ïà¶ÔÓÚÖ÷±íÀ´Ëµ£¬Ñ§Éú³É¼¨µÄ×ֶΠѧºÅ¾ÍÊÇѧÉú±íµÄÍâ¼ü¡£
  ûÓÐÍâ¼ü£¬Á½¸ö±í¾Íû°ì·¨½¨Á¢ÁªÏµ°¡£¡ ......

oracle SQL·ÖÀà

ORACLE ÖÐSQL Óï¾ä´óÖ¿ÉÒÔ·ÖΪ4´óÀà
1.DQL£¨data quary language Êý¾Ý²éѯÓïÑÔ£©
Êý¾Ý²éѯÓïÑÔDQL»ù±¾½á¹¹ÊÇÓÉSELECT×Ӿ䣬from×Ӿ䣬WHERE×Ó¾ä×é³É
2.DDL£¨data definition language Êý¾Ý¶¨ÒåÓïÑÔ£©
CREATE
ALTER
DROP
RENAME
TRUNCATE
3.DML£¨data manipulation language Êý¾Ý²Ù×ÝÓïÑÔ£©
INSERT
UPDATE ......

°ÑSQL ServerÊý¾Ý±íµÄÄÚÈÝת»»ÎªÏàÓ¦µÄINSERTÓï¾ä

±ÊÕßÔøÔÚ¡¶³ÌÐòÔ±¡·2009Äê11ÆÚÉÏ̽ÌÖTransact-SQLµÄÔª±à³Ì£¬¼´Í¨¹ýĿ¼ÊÓͼ¡¢ÔªÊý¾Ýº¯ÊýµÈ·½Ê½·ÃÎÊÊý¾Ý¿âµÄÔªÊý¾ÝÐÅÏ¢£¬ÔÚÖ´Ðйý³ÌÖж¯Ì¬Éú³ÉSQL½Å±¾¡£µ±Ê±ÏÞÓÚƪ·ù£¬Ëù¸øµÄÀý×Ó½ÏÉÙ¡£ÕâÀï¸ø³ö¶¯Ì¬Éú³ÉSQL½Å±¾µÄÒ»¸öµäÐÍÓ¦Ó㬰ÑÊý¾Ý±íµÄÄÚÈÝת»»ÎªÏàÓ¦µÄINSERTÓï¾ä¡£
Õâ¸öÆô·¢À´×ÔÎÒ¹ÜÀíÔ¶³ÌÊý¾Ý¿âµÄ¾­Àú¡£ÎÒ³£³£ÐèÒªÓñ¾ ......

SQL MINUSµÄÓ÷¨


< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ