SQL_ѧÉú
µÚÒ»²¿·Ö
µ¥±í²éѯ
ÀýÒ»£º²éѯȫÌåѧÉúµÄѧºÅÓëÐÕÃû
SELECT Sno,Sname
from Student;
Àý¶þ£º²éѯȫÌåѧÉúµÄÐÕÃû¡¢Ñ§ºÅ¡¢ËùÔÚϵ
SELECT Sname,Sno,Sdept
from Student;
ÀýÈý£º²éѯȫÌåѧÉúµÄÏêϸ¼Ç¼
SELECT *
from Student;
µÈ¼ÛÓÚ£º
SELECT *
from Student;
ÀýËÄ£º²éѯȫÌåѧÉúµÄÐÕÃû¼°Æä³öÉúÄê·Ý
SELECT Sname,2009-Sage
from Student;
ÀýÎ壺²éѯȫÌåѧÉúµÄÐÕÃû¡¢³öÉúÄê·ÝºÍËùÔÚµÄԺϵ£¬ÒªÇóÓÃСд×Öĸ±íʾËùÓеÄϵÃû
SELECT Sname,'Year of Birth:',2004-Sage,LOWER(Sdept)
from Student;
Ö¸¶¨ÁбðÃûÈçÏ·½·¨£º
SELECT Sname NAME,'Year of Birth:' BIRTH,2009-Sage BIRTHDAY,
LOWER(Sdept) DEPARTMENT
from Student;
ÀýÁù£º²éѯѡÐÞÁ˿γ̵ÄѧÉúµÄѧºÅ
SELECT Sno //µÈ¼ÛÓÚSELECT ALL Sno
from SC;
È¥µôÖظ´Ðз½·¨£º
SELECT DISTINCT Sno
from SC;
ÀýÆߣº²éѯ¼ÆËã»ú¿ÆѧϵȫÌåѧÉúµÄÃûµ¥
SELECT Sname
from Student
WHERE Sdept='CS';
Àý°Ë£º²éѯËùÓÐÄêÁäÔÚ20ËêÒÔϵÄѧÉúµÄÐÕÃû¼°ÆäÄêÁä
SELECT Sname,Sage
from Student
WHERE Sage<20;
Àý¾Å£º²éѯ¿¼ÊԳɼ¨Óв»¼°¸ñµÄѧÉúµÄѧºÅ
SELECT DISTINCT Sno
from SC
WHERE Grade<60;
ÀýÊ®£º²éѯÄêÁäÔÚ20-23Ëê(°üÀ¨20ËêºÍ23Ëê)Ö®¼äµÄѧÉúµÄÐÕÃû¡¢Ïµ±ðºÍÄêÁä
SELECT Sname,Sdept,Sage
from Student
WHERE Sage BETWEEN 20 AND 23;
Àýʮһ£º²éѯÄêÁä²»ÔÚ20-23ËêÖ®¼äµÄѧÉúµÄÐÕÃû¡¢Ïµ±ð¡¢ºÍÄêÁä
SELECT Sname,Sdept,Sage
from Student
WHERE Sage NOT BETWEEN 20 AND 23;
ÀýÊ®¶þ£º²éѯ¼ÆËã»ú¿Æѧϵ(CS)¡¢Êýѧϵ(MA)ºÍÐÅϢϵ(IS)ѧÉúµÄÐÕÃûºÍÐÔ±ð
SELECT Sname,Ssex
from Student
WHERE Sdept IN('CS','MA','IS');
µÈ¼ÛÓÚ£º
SELECT Sname,Ssex
from Student
WHERE Sdept='CS'OR Sdept='MA' OR Sdept='IS';
ÀýÊ®Èý£º²éѯ¼È²»ÊǼÆËã»ú¿Æѧϵ¡¢Êýѧϵ£¬Ò²²»ÊÇÐÅϢϵµÄÐÕÃûºÍÐÔ±ð
SELECT Sname,Ssex
from Student
WHERE Sdept NOT IN('IS','MA','CS');
ÀýÊ®ËÄ£º²éѯѧºÅΪ200215121µÄѧÉúµÄÏêϸÇé¿ö
SELECT *
from Student
WHERE Sno LIKE '200215126 ';//ÊäÈëÊý×Ö6ºó¿ÕÒ»¸ñºóÊäÈëµ¥ÒýºÅ£¬·ñÔò²éѯ²»ÏÔʾ
µÈ¼ÛÓÚ£º
SELECT *
from Student
WHERE Sno='200215121';
ÀýÊ®Î壺²éѯËùÓÐÐÕÁõµÄѧÉúµÄÐÕÃû¡¢Ñ§ºÅºÍÐÔ±ð
SELECT Sname,Sno,Ssex
from Student
WHERE Sname LIKE 'Íõ%';
ÀýÊ®Áù£º²éѯÐՔŷÑô”ÇÒÈ«ÃûÎ
Ïà¹ØÎĵµ£º
General Overview
FeatureSQL Server 2008 (RC0)MySQL 5.1/6PostgreSQL 8.3/PostGIS 1.3/1.4
OS
Windows XP, Windows Vista, Windows 2003, Windows 2008
Windows XP, Windows Vista, (haven't tested on 2008), Linux, Unix, Mac
Windows 2000+ (including Vista and 2003, haven't tested on 2008), Linux, Unix, Ma ......
ÅäÖÃʹÓà SQL ServerÌṩ³ÌÐò
<configuration>
<system.web> <-- ¸ü¸ÄÌṩ³ÌÐòÅäÖ㺠-->
<membership defaultProvider="AspNetSqlProvider" />
</system.web>
<membership> <--ÅäÖÃÌṩ³ÌÐò -->
<prov ......
½ñÌìÔÚһ̨Ðé»úÉÏ°²×° sql server 2005£¬¾ÓÈ»±¨1´íÁË£¨ÎÞÓïÁË£¬×°Õâ¸ö¶«Î÷¶¼Åª²»ºÃ%>_<%£©¿ªÊ¼ÒÔΪÊÇÒòΪADÓòµÄÔÒò£¬ºóÀ´É¾µôÓòÓÖÖؽ¨Óò£¬È»ºóÔÙ×°£¬ÓÖ±¨2´í£¬ÓÚÊÇÎʱðÈËËÑË÷µÈµÈ£¬ÕÒµ½ÔÒò˵ҪÖØÐÂ×¢²áinstaller£¬×îÖÕ°²×°³É¹¦ÁË£¬º¦ÎÒ¼Ó°àŪµÄ£¬¸ßÐ˵ÄÊÇ°²×°ºÃÀ²£¬¿ÉÊÇÎÒûÓÐŪÃ÷°×µ½µ×ÊÇɶÔÒòµ¼ÖÂsql°²×°²»ÁËÄØ£ ......
Èç¹ûÒ»¸ö SQL Óï¾ä·¢ÉúÁË´íÎó£¬ÄÇô sqlca.sqlcode ½«ÊÇ·ÇÁãÖµ¡£
Èç¹û sqlca.sqlcode СÓÚ 0 ÄÇô¾ÍÊÇ·¢ÉúÁËijÖÖÑÏÖصĴíÎó£¬ÏóÊý¾Ý¿â¶¨ÒåÓë²éѯ¶¨Òå²»Ò»Öµȣ®
Èç¹û´óÓÚ 0 ÔòÊÇͨ³£µÄ´íÎó£¬Ïó±í²»°üÀ¨ËùÒªÇóµÄÐеȣ®
sqlca.sqlcode == 0£¬³É¹¦
sqlca.sqlcode == -1 ʧ°Ü £¨»ñÈ¡¾ßÌåʧ°ÜÐÅÏ¢ ......