SQL²éѯ´ð°¸
Ò»¡¢µ¥±í²éѯÁ·Ï°
1¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯѧÉú"ÕÅÈý"µÄÈ«²¿»ù±¾ÐÅÏ¢
Select *
from A_studentinfo
where sname='ÕÅÈý'
2¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯѧÉú"ÕÅÈý"ºÍ”ÀîËÄ”µÄ»ù±¾ÐÅÏ¢
Select *
from A_studentinfo
where sname='ÕÅÈý'
or sname='ÀîËÄ'
3¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯÐÕ"ÕÅ"ѧÉúµÄ»ù±¾ÐÅÏ¢
Select *
from A_studentinfo
where sname like 'ÕÅ%'
4¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯÐÕÃûÖк¬ÓÐ"ËÄ"×ÖµÄѧÉúµÄ»ù±¾ÐÅÏ¢
Select *
from A_studentinfo
where sname like '%ËÄ%'
5¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯÐÕÃû³¤¶ÈΪÈý¸ö×Ö£¬ÐÕ“À¬ÇÒ×îºóÒ»¸ö×ÖÊÇ“Ç¿”µÄÈ«²¿Ñ§ÉúÐÅÏ¢¡£
select *
from A_studentinfo
where sname like 'Àî_Ç¿'
6¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯÐÕ"ÕÅ"»òÕßÐÕ”ÀÄѧÉúµÄ»ù±¾ÐÅÏ¢¡£
Select *
from A_studentinfo
where sname like 'ÕÅ%'
or sname like 'Àî%'
7¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯÐÕ"ÕÅ"²¢ÇÒ"ËùÊôÊ¡·Ý"ÊÇ"±±¾©"µÄѧÉúÐÅÏ¢
Select *
from A_studentinfo
where sname like 'ÕÅ%'
and province='±±¾©'
8¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯ"ËùÊôÊ¡·Ý"ÊÇ"±±¾©"¡¢”н®”¡¢”ɽ¶«”»òÕß"ÉϺ£"µÄѧÉúµÄÐÅÏ¢
Select *
from A_studentinfo
where province in ('±±¾©','ÉϺ£','н®','ɽ¶«')
9¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯÐÕ"ÕÅ"£¬µ«ÊÇ"ËùÊôÊ¡·Ý"²»ÊÇ"±±¾©"µÄѧÉúÐÅÏ¢
Select *
from A_studentinfo
where sname like 'ÕÅ%'
and province !='±±¾©'
10¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯȫ²¿Ñ§ÉúÐÅÏ¢£¬²¢°´ÕÕ“ÐÔ±ð”ÅÅÐò£¬ÐÔ±ðÏàͬµÄÇé¿öÏ°´ÕÕ“ËùÊôÊ¡·Ý”ÅÅÐò£¬ËùÊôÊ¡·ÝÏàͬµÄÇé¿öÏÂÔÙ°´ÕÕ“°à¼¶”ÅÅÐò
select *
from A_studentinfo
order by sex,province,class
11¡¢²éѯ<ѧÉúÐÅÏ¢±í>£¬²éѯÏÖÓÐѧÉú¶¼À´×ÔÓÚÄÄЩ²»Í¬µÄÊ¡·Ý
select distinct province as Ê¡·Ý
from A_studentinfo
12¡¢²éѯ<ѧÉúÑ¡ÐÞÐÅÏ¢±í>£¬²éѯûÓÐÌîд³É¼¨µÄѧÉúµÄѧºÅ¡¢¿Î³ÌºÅºÍ³É¼¨
Select *
from A_studentcourse
where score is null
13¡¢²éѯ<ѧÉúÑ¡ÐÞÐÅÏ¢±í>£¬²éѯȫ²¿ÌîдÁ˳ɼ¨µÄѧÉúµÄÑ¡ÐÞÐÅÏ¢£¬²¢°´ÕÕ“³É¼¨”´Ó¸ß
Ïà¹ØÎĵµ£º
ͨ³££¬ÄãÐèÒª»ñµÃµ±Ç°ÈÕÆںͼÆËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬ÄãµÄ³ÌÐò¿ÉÄÜÐèÒªÅжÏÒ»¸öÔµĵÚÒ»Ìì»òÕß×îºóÒ»Ìì¡£ÄãÃǴ󲿷ÖÈË´ó¸Å¶¼ÖªµÀÔõÑù°ÑÈÕÆÚ½øÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»ºó½ö½öÓ÷ָî³öÀ´µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ¼¸¸öº¯ÊýÖмÆËã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡
¡¡¡¡ÔÚÕâƪÎÄÕÂÀÎÒ½«¸æËßÄãÈçºÎʹÓÃDATEADDºÍDATEDIFFº¯ÊýÀ´¼ÆËã³öÔÚÄã ......
ΪÁËÖ´ÐÐsqlÓï¾ä£¬ÎÒÃÇ»áÔÚaccessÊý¾Ý¿âÖÐÖ´ÐÐsqlÓï¾ä£¬ÕâÑù·½±ãÎÒÃÇ·ÖÎö¡£·½·¨ÈçÏ£º
´ò¿ªaccessÊý¾Ý¿â£¬µã»÷”´´½¨“£¬ÔÚµ¥»÷“²éѯÉè¼Æ”£¬»áµ¯³öÒ»¸öÏÔʾ±íµÄ´°¿Ú£¬¹Øµô¡£»á³öÏÖÒ»¸ösqlÊÔͼ£¬´ò¿ª¾Í¿ÉÒÔÔÙÀïÃæдsql´úÂëÁË¡£ ......
Ò».Ãû´Ê½âÊÍ£º
0¡£SQL ½á¹¹»¯²éѯÓïÑÔ(Structured Query Language)
1¡£·Ç¹ØϵÐÍÊý¾Ý¿âϵͳ
×öΪµÚÒ»´úÊý¾Ý¿âϵͳµÄ×ܳƣ¬Æä°üÀ¨2ÖÖÀàÐÍ£º“²ã´Î”Êý¾Ý¿âÓë“Íø×´”Êý¾Ý¿â
“²ã´Î”Êý¾Ý¿â¹ÜÀíϵͳ eg:IBM&IMS (Information Management System ......
1.ORACLE²ÉÓÃ×Ô϶øÉϵÄ˳Ðò½âÎöWHERE×Ó¾ä,¸ù¾ÝÕâ¸öÔÀí,±íÖ®¼äµÄÁ¬½Ó±ØÐëдÔÚÆäËûWHEREÌõ¼þ֮ǰ, ÄÇЩ¿ÉÒÔ¹ýÂ˵ô×î´óÊýÁ¿¼Ç¼µÄÌõ¼þ±ØÐëдÔÚWHERE×Ó¾äµÄĩβ.
(µÍЧ)
SELECT … from EMP E WHERE SAL > 50000 AND JOB = ‘MANAGER’ AND 25 < (SELECT COUNT(*) from EMP WHERE MGR=E. ......
¾ßÌå²½Ö裺
¡¡¡¡Ò».ÔÚ·þÎñÆ÷¶ËÒÔ
dbsrv7.exe pathyyy.db -n
ServiceName -x tcpip -q
¡¡¡¡Æô¶¯Êý¾Ý¿â£¬ÕâÀïÒ²¿ÉÒÔÖ¸¶¨¶Ë¿Ú£¬ÏêϸµÄ²ÎÊýÇëÓÃdbsrv7.exe /?»ñÈ¡¡£
¡¡¡¡-n servicename:Æô¶¯·þÎñÃûΪservicenameµÄÊý¾Ý¿â·þÎñÓÃÒÔ±ê¼ÇÍøÂçÊý¾Ý¿â·þÎñΨһ±ê¼Ç£»
¡¡¡¡-x tcpip£ºÊ¹ÓÃtcp/ipÐÒ飬ĬÈ϶˿Ú3362,×¢Òâ²»Òª± ......