SQL²éѯ - MS-SQL Server / »ù´¡Àà
ËäÈ»ÓõÄORACLE SQL²éѯÓï¾ä»¹ÊÇͨµÄ
--´´½¨Ó°ÌüÐÅÏ¢±í(cinemaInfo)
create table cinemaInfo
(
cid number primary key,--񅧏
cname varchar2(10) not null, --Ó°ÌüÃû³Æ
remark varchar2(50)
);
--µçÓ°ÐÅÏ¢±í(filmInfo)
create table filmInfo
(
fid number primary key,--񅧏
fname varchar2(20) not null,--µçÓ°Ãû³Æ
director varchar2(20) not null,--µ¼ÑÝ
starring varchar2(20) not null,--Ö÷ÑÝ
style varchar2(20) not null,--ÀàÐÍ
flanguage varchar2(20) not null,--ÓïÑÔ
fdate date not null,--ÉÏÓ³ÈÕÆÚ(µçÓ°Ê×Ó³ÈÕÆÚ)
length varchar2(10) not null,--Ƭ³¤(µçÓ°Ëù²¥·ÅµÄ³¤¶È)
price number(4,1) not null,--¼Û¸ñ
image varchar2(50) not null,--ͼƬ
drama varchar2(100),--¾çÇé
critic varchar2(50) --Ò»¾ä»°Ó°ÆÀ
);
--ӰƬÉÏӳʱ¼ä±í(release)
create table release
(
rid number primary key,--ÉÏӳʱ¼ä±í±àºÅ
fid number references filmInfo(fid),--µçÓ°±àºÅ(Íâ¼ü)
cid number references cinemaInfo(cid),--ËùÒª²¥·ÅµÄÓ°Ìü±àºÅ(Íâ¼ü)
rdate date not null,--ÉÏÓ³ÈÕÆÚ
rtime date not null --ÉÏӳʱ¼ä 19:30
);
Ó°Ìü±àºÅ,µçÓ°±àºÅ,ÈÕÆÚ¿ÉÒÔÑ¡Ôñ,Äõõ½
Òª¿¼ÂÇƬ³¤(µçÓ°²¥·ÅµÄ³¤¶È)
¼ÙÈ磺ӰÌü±àºÅ1 µçÓ°±àºÅ1 ÈÕÆÚÑ¡Ôñ 2010-05-29 ʱ¼äÑ¡ÔñÊÇ 19:30
ÎÒÏëÅÐ¶Ï ¸ÃӰƬ ¸ÃÓ°Ìü ¸ÃÈÕÆÚ ÊÇ·ñÄÜÔÚ¸Ãʱ¼ä ÄÜ·ñÉÏÓ³
À´µãÊý¾Ý°É£
Ïà¹ØÎÊ´ð£º
ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......
ÈçºÎÔÚSQL2005ÖÐÉ趨¶¨Ê±×÷Òµ£¬±ÈÈç˵¶¨Ê±ÇåÀíijЩ±íµÄÊý¾Ý£¬
»òÕßÊǶ¨Ê±µÄ½«Ä³Ð©±íµÄÊý¾Ýµ¼³öexcel£¡
ÔÚÏߵȴý£¬¼±¼±¼±£¬×îºÃÊÇÏêϸ²½Ö裡
֮ǰÎÒ×öµÄ×÷ÒµÓеãÎÊÌ⣡
°ïUP
²Î¿¼:http://hi.baidu.com/toiota ......
½«Ò»¸ö²éѯÓï¾ä¸³¸øÒ»¸ö±äÁ¿£¬ÈçÏ£º
DECLARE @STR NVARCHAR(MAX)
SET @STR='SELECT * from SALE_PROD'
ÔõôÑù²ÅÄÜÖ´ÐÐËüÄØ£¿
Çë¸ßÊÖ£¬ÈÊÐÖ£¬ÏÀ½ã°ï°ïæ°¡
¶àл£¬¿ÉÒÔÀ²£¬¸ßÊÖ°¡
Ö±½ÓÖ´ÐоÍÐÐÁË
exec ......
±íÊý¾Ý
COL1 COL2 COL2 COL4 COL5
----------------------------------------------------------------------------------------------
2010-05-05 00:00 ......
Ôõô°ÑMDFÊý¾Ýתµ½MySQL£¿
ÖÁÉٵø½¼Óµ½sqlserverÉÏ
¾ßÌåÔõôŪ°¡ ÎҵıÏÒµÉè¼ÆµÄÊý¾Ý¿âÊÇ´ÓÍøÉÏdownÏÂÀ´µÄ£¿£¿
Ä㻹²»ÈçÖ±½ÓÓÃsqlserverÄØ
º¯Êý¡¢´æ´¢¹ý³Ì¶¼µÃ¸ÄÁË¡£
sqlserverûÔõôÓùý¡£Ò²Ã»Óа²× ......