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

Ò»¸öÏîÄ¿Éæ¼°µ½µÄ50¸öSQLÓï¾ä

 /* 
 ±êÌ⣺һ¸öÏîÄ¿Éæ¼°µ½µÄ50¸öSQLÓï¾ä(ÕûÀí°æ) 
 ×÷Õߣº°®Ð¾õÂÞ.ع»ª
 Ê±¼ä£º2010-05-10 
 ËµÃ÷£ºÒÔÏÂÎåÊ®¸öÓï¾ä¶¼°´ÕÕ²âÊÔÊý¾Ý½øÐйý²âÊÔ£¬×îºÃÿ´ÎÖ»µ¥¶ÀÔËÐÐÒ»¸öÓï¾ä¡£ 
 ÎÊÌâ¼°ÃèÊö£º 
 --1.ѧÉú±í 
 Student(S#,Sname,Sage,Ssex) --S# ѧÉú±àºÅ,Sname ѧÉúÐÕÃû,Sage ³öÉúÄêÔÂ,Ssex ѧÉúÐÔ±ð 
 --2.¿Î³Ì±í  
 Course(C#,Cname,T#) --C# --¿Î³Ì±àºÅ,Cname ¿Î³ÌÃû³Æ,T# ½Ìʦ±àºÅ 
 --3.½Ìʦ±í  
 Teacher(T#,Tname) --T# ½Ìʦ±àºÅ,Tname ½ÌʦÐÕÃû 
 --4.³É¼¨±í  
 SC(S#,C#,score) --S# ѧÉú±àºÅ,C# ¿Î³Ì±àºÅ,score ·ÖÊý 
 */ 
 --´´½¨²âÊÔÊý¾Ý 
 create table Student(S# varchar(10),Sname nvarchar(10),Sage datetime,Ssex nvarchar(10)) 
 insert into Student values('01' , N'ÕÔÀ×' , '1990-01-01' , N'ÄÐ') 
 insert into Student values('02' , N'Ç®µç' , '1990-12-21' , N'ÄÐ') 
 insert into Student values('03' , N'Ëï·ç' , '1990-05-20' , N'ÄÐ') 
 insert into Student values('04' , N'ÀîÔÆ' , '1990-08-06' , N'ÄÐ') 
 insert into Student values('05' , N'ÖÜ÷' , '1991-12-01' , N'Å®') 
 insert into Student values('06' , N'ÎâÀ¼' , '1992-03-01' , N'Å®') 
 insert into Student values('07' , N'Ö£Öñ' , '1989-07-01' , N'Å®') 
 insert into Student values('08' , N'Íõ¾Õ' , '1990-01-20' , N'Å®') 
 create table Course(C# varchar(10),Cname nvarchar(10),T# varchar(10)) 
 insert into Course values('01' , N'ÓïÎÄ' , '02') 
 insert into Course values('02' , N'Êýѧ' , '01') 
 insert into Course values('03' , N'Ó¢Óï' , '03') 
 create table Teacher(T# varchar(10),Tname nvarchar(10)) 
 insert into Teacher values('01' , N'ÕÅÈý') 
 insert into Teacher values('02' , N'ÀîËÄ') 
 insert into Teacher values('03' , N'ÍõÎå') 
 create table SC(S# varchar(10),C# varchar(10),score decimal(18,1))&nbs


Ïà¹ØÎĵµ£º

¹ØÓÚSQLÖÐcountµÄЧÂÊ

COUNT(*)ÓëCOUNT(COL)
ÍøÉÏËÑË÷ÁËÏ£¬·¢ÏÖ¸÷ÖÖ˵·¨¶¼ÓУº
±ÈÈçÈÏΪCOUNT(COL)±ÈCOUNT(*)¿ìµÄ£»
ÈÏΪCOUNT(*)±ÈCOUNT(COL)¿ìµÄ£»
»¹ÓÐÅóÓѺܸãЦµÄ˵µ½Õâ¸öÆäʵÊÇ¿´ÈËÆ·µÄ¡£
ÔÚ²»¼ÓWHEREÏÞÖÆÌõ¼þµÄÇé¿öÏ£¬COUNT(*)ÓëCOUNT(COL)»ù±¾¿ÉÒÔÈÏΪÊǵȼ۵ģ»
µ«ÊÇÔÚÓÐWHEREÏÞÖÆÌõ¼þµÄÇé¿öÏ£¬COUNT(*)»á±ÈCOUNT(COL)¿ì·Ç³£¶à ......

oracle pl/sqlʵÀýÁ·Ï°


µÚÒ»²¿·Ö£ºoracle pl/sqlʵÀýÁ·Ï°(1)
Ò»¡¢Ê¹ÓÃscott/tigerÓû§ÏµÄemp±íºÍdept±íÍê³ÉÏÂÁÐÁ·Ï°£¬±íµÄ½á¹¹ËµÃ÷ÈçÏÂ
empÔ±¹¤±í(empnoÔ±¹¤ºÅ/enameÔ±¹¤ÐÕÃû/job¹¤×÷/mgrÉϼ¶±àºÅ/hiredateÊܹÍÈÕÆÚ/salн½ð/commÓ¶½ð/deptno²¿ÃűàºÅ)
dept²¿Ãűí(deptno²¿ÃűàºÅ/dname²¿ÃÅÃû³Æ/locµØµã)
¹¤×Ê £½ н½ð £« Ó¶½ð
Ò²¿ÉÒÔͨ¹ý ......

SQL ×Ö¶Î帶¿Õ

SELECT * from xcmis.temp_odr_prom@linkxceis where trim(ODR_NO) like 'CA10010082'
SELECT * from xcmis.temp_odr_prom@linkxceis where ODR_NO like 'CA10010082%'
SELECT * from xcmis.temp_odr_prom@linkxceis where ODR_NO = 'CA10010082'
OK
SELECT * from xcmis.temp_odr_prom@linkxceis where ODR_NO like 'C ......

Sql²Ù×÷´óÈ«

SQL²Ù×÷È«¼¯
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ 
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE) 
DML—Êý¾Ý²Ù×ÝÓïÑÔ(
SELECT£¬DELETE£¬UPDATE£¬INSERT) 
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£ ......

sql¾«Õ¿·ÖÒ³Óï¾ä

select top Ò³´óС *
from table1
where id>
      (select max (id) from
      (select top ((Ò³Âë-1)*Ò³´óС) id from table1 order by id) as T) order by id ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ