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

SQL»ù´¡

##   ɾ³ýÊý¾Ý¿â
drop  database  ecport;
##   ´´½¨Êý¾Ý¿â
create   database   ecport;
##   ʹÓÃÊý¾Ý¿â
use   ecport;

##   ¹ú¼Ò±í½á¹¹
create   table COUNTRY(
               country_id     int  primary key auto_increment,
               name           varchar(64)
             
               );
##   Ä£Äâ¹ú¼Ò±íÊý¾Ý              
INSERT INTO COUNTRY( name ) VALUES ('Öйú');

##   Ê¡·Ý±í½á¹¹
create   table PROVINCE(
               province_id     int  primary key auto_increment,
               name           varchar(64),
               country_id      int  references   COUNTRY(country_id)
               );
              
//    Ä£ÄâÊ¡·Ý±íÊý¾Ý
INSERT INTO province (province_id , name , country_id ) VALUES (1, '°²»Õ', 1);
INSERT INTO province (province_id , name , country_id ) VALUES (2, '±±¾©', 1);
INSERT INTO province (province_id , name , country_id ) VALUES (3, 'ÖØÇì', 1);
INSERT INTO province (pr


Ïà¹ØÎĵµ£º

SQL Server 2008µÄ¹ÜÀí¹¤¾ßÒªÏûºÄ¸ü¶àµÄÄÚ´æ

2008µÄSSMS±È2005°æÒª¶àÏûºÄÒ»±¶×óÓÒµÄÄڴ棬¶øÇÒËƺõ²»»á×Ô¼ºÊÍ·Å£¬ÖÁÉÙÒ²ÊÇÄÚ´æ¹ÜÀí²»ÊǺܺÏÀí£¬ÍùÍù´ò¿ª¼¸¸ö²éѯ´°¿Ú½øÐвéѯºóÄÚ´æ¾Í»áÉýµ½ÄÑÒÔ200MBµ½300MB£¬ÇҹصôºóÄÚ´æ²»»áÊÍ·Å£¬¶ø2005µÄSSMSÒ»°ãÖ»ÊÇÔÚ100MB×óÓÒ¡£¶ÔÓµÓдóÄÚ´æµÄµçÄÔÀ´ËµÕâ¿ÉÄܲ»Ëãʲô£¬µ«¶ÔÄÚ´æÖ»ÓÐ1G»ò¸üÉÙµÄÓû§À´Ëµ£¬Õ⼸ºõÊDz»¿ÉÈÝÈ̵ģ¬ÒòÎ ......

[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(¶þ)

±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Ò»)--sum()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(¶þ)--max()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Èý)--row_number() /rank()/dense_rank()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(ËÄ)--lag()/lead()
Èç¹ûÎÒÃÇ°´ÕÕʾÀýÏëµÃµ½Ã¿¸ö²¿ÃÅнˮֵ×î¸ßµÄ¹ÍÔ±µÄ¼Í¼£¬¿ÉÒÔÓÐËÄÖÖ·½·¨ÊµÏÖ£ ......

[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Îå)

±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Ò»)--αÁÐROWNUMʹÓü¼ÇÉ
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(¶þ)--±êÁ¿×Ó²éѯ
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Èý)--PackageµÄÓŵã
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(ËÄ)--ÅúÁ¿´¦Àí
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Îå)--µ÷Óô洢¹ý³Ì·µ»Ø½á¹û¼¯
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Áù)- ......

PL/SQL³£Óþ䷨

1¡¢Ñ­»·²åÈë²âÊÔÊý¾Ý£º
SQL>
declare
maxrecords constant int:=100;
i int :=1;
Begin
for i in 1..maxrecords loop

--²åÈëÊý¾Ý
Insert into TEST.EXAMPLE(name,phone,address) values('·ÖÒ³²âÊÔÊý¾Ý....','ÁªÏµµç»°','ÁªÏµµØÖ·');
end loop;
commit;
end;
´Ë´¦EXAMPLE±í¶¨ÒåΪ(ID number,name ......

SQLÖеÄIF ELSE£¨CASEÓï¾äµÄʹÓã©

----start
    ´ó¼Ò¶ÔIF ELSEÓï¾ä¿ÉÄܶ¼ºÜÊìϤ£¬ËüÊÇÓÃÀ´¶Ô¹ý³Ì½øÐпØÖƵġ£ÔÚSQLµÄÊÀ½çÖÐCASEÓï¾äÓï¾äÓÐÀàËƵÄЧ¹û¡£ÏÂÃæ¼òµ¥µÄ½éÉÜCASEÓï¾äµÄÓ÷¨¡£¿¼ÂÇÏÂÃæµÄÇé¿ö£¬¼ÙÉèÓиöuser±í£¬¶¨ÒåÈçÏ£º
CREATE TABLE USER
(
NAME VARCHAR(20) NOT NULL,---ÐÕÃû
SEX INTEGER,---ÐÔ±ð£¨1¡¢ÄÐ 2¡¢Å®£©
BIRTHDA ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ