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

SQLѧϰ֮Á¬½Ó·û£¬ÊýÖµÔËË㣬º¯Êý

create table bookitem
(
bookname varchar(80) not null,
book_price Decimal(5,2) not null,
quantity int not null
)
 
insert into bookitem values('Image Processing',34.95,8)
insert into bookitem values('Signal Processing',51.75,6)
insert into bookitem values('Singal And System',48.5,10)
insert into bookitem values('Digital Signal Processing',45.0,12)
insert into bookitem values('The Logic Circuit',28.65,10)
insert into bookitem values('SQL Techniques',65.50,10)
insert into bookitem values('A Firest Course in Database Systems',52.80,9)
 
 
-------Teacher
create table teacher
(
TNO int not null,
TNAME char(10) not null,
CNO int not null,
SAL int,
DNAME char(10) not null,
TSEX char(2) not null,
AGE int not null
)
 
insert into teacher values(1,'Íõ¾ü',4,800,'Êýѧ','ÄÐ',32)
insert into teacher values(2,'ÀîÍ®',5,1200,'ÉúÎï','Å®',54)
insert into teacher values(3,'ÍõÓÀ¾ü',1,900,'¼ÆËã»ú','ÄÐ',40)
insert into teacher values(4,'ÁõС¾²',2,1200,'¼ÆËã»ú','Å®',39)
insert into teacher values(5,'¸ßΰ',8,2100,'µç×Ó¹¤³Ì','ÄÐ',39)
insert into teacher values(6,'Àîΰ',7,1200,'»úе¹¤³Ì','ÄÐ',29)
insert into teacher values(3,'ÍõÓÀ¾ü',1,900,'¼ÆËã»ú','ÄÐ',40)
 
 
---Course
create table course
(
CNO int not null,
CNAME char(30) not null,
CTIME int not null,
SCOUNT int not null,
CTEST smalldatetime not null
)
 
insert into course values(4,'Ó¦ÓÃÊýѧ»ù´¡',48,120,2006-7-10)
insert into course values(5,'ÉúÎ﹤³Ì¸ÅÂÛ',32,80,2006-7-8)
insert into course values(1,'¼ÆËã»úÈí¼þ»ù´¡',32,70,2006-7-8)
insert into course values(2,'¼ÆËã»úÓ²¼þ»ù´¡',28,90,2006-7-10)
insert into course values(8,'Ä£Äâµç·Éè¼Æ',48,120,2006-7-10)
insert into course values(3,'ÉúÎﻯѧ',32,40,2006-7-2)
insert into course values(9,'Êý¾Ý¿âÉè¼Æ',16,80,2006-7-1)
insert into course values(6,'Éè¼ÆÀíÂÛ',28,45,2006-6-30)
 
 
create table student
(
SNO char(4) not null,
sname char(10) not null,
dname char(10) not null,
sex char(2),
CNO i


Ïà¹ØÎĵµ£º

oraleÖÐsqlÓï¾ä¶ÔnullÖµµÄ´¦Àí

µÚÒ»ÖÖ·½·¨£ºÊ¹ÓÃNVLº¯Êý´¦ÀíNULLÖµ¡£
ÆäÓï·¨¸ñʽÊÇNVL(exp1,exp2)¡£ÆäÖвÎÊýexp1ºÍexp2¿ÉÒÔʹÈÎÒâÊý¾ÝµÄÀàÐÍ£¬µ«Á½ÕßÊý¾ÝÀàÐͱØÐëÆ¥Å䡣ʾÀý£ºselect ename,sal,comm,sal+nvl(comm,0) as salary from emp;
µÚ¶þÖÖ·½·¨£ºÊ¹ÓÃNVL2º¯Êý´¦ÀíNULLÖµ¡£
ÆäÓï·¨¸ñʽÊÇNVL2(exp1,exp2,exp3)¡£ÕâÊÇoracle9iÐÂÔö¼ÓµÄº¯Êý¡£Èç¹ûexp1 ......

¡¾×ª¡¿ ¹ØÓÚPL/SQLÖжԴ洢¹ý³Ìadd debug information

¹ØÓÚPL/SQLÖжԴ洢¹ý³Ìadd debug information
http://space.itpub.net/13129975/viewspace-626245
 
Èç¹ûʹÓÃPL/SQL DeveloperÖÐÑ¡ÔñÒ»¸ö´æ´¢¹ý³Ìdebugµ«ÓÖdebug²»½øÈ¥£¡
½â¾öÕâ¸öÎÊÌâÊǺܼòµ¥µÄ£¬Ö»ÐèÒªÔÚPL/SQL DeveloperÖÐÑ¡ÔñÒªdebugµÄ´æ´¢¹ý³Ì£¬È»ºóµãÓÒ¼ü£¬ÔÚµ¯³öµÄ²Ëµ¥ÖÐÑ¡Ôñ"Add debug information"ºóÔÙÖ ......

SQL ѧϰ±Ê¼ÇÖ®Ë÷Òý

----use pubs-sales
-----´´½¨Ë÷Òý
create index index_name
on authors(au_lname)
--´´½¨Ë÷Òýºó±íÖÐËùÓеÄÊý¾Ý¸ú֮ǰûÓÐÇø±ð
select * from authors
--µ¥¶À²éË÷ÒýÁÐ
select au_lname from authors
--Ç¿ÖÆÊ¹Ó÷Ǵؼ¯Ë÷Òý
select * from  authors with(index(index_name))
--¶à×ֶηǴؼ¯Ë÷Òý
create inde ......

SQL ServerÊý¾Ý¿âΪʲô²»Äָܻ´µ¥±íÊý¾Ý

Èç¹ûÄÜ´Ó±¸·ÝÎļþÖÐÖ»»Ö¸´Ò»¸ö±íµÄÊý¾Ý£¬ÄDz»ÊǺܺÃÂ𣿱ÈÈ磬Ä㱸·ÝÁËAdventureWorksÊý¾Ý¿â£¬ÏÖµÄÄãÖ»»Ö¸´ÀïÃæVendor±íÊý¾Ý¡£²»ÐÒµÄÊÇ£¬SQL Server±¾Éí²¢²»Ö§³ÖÕâÑù»¹Ô­£¬ÄãÐèÒª´ÓµÚÈý·½ÌṩµÄ¹¤¾ßÖÐÀ´Ö´ÐÐÕâÑùµÄÈÎÎñ¡£
ÌṩÕâÖÖ¹¦ÄܵijÌÐò¶¼ÊÇһЩSQL ServerµÚÈý·½±¸·Ý¹¤¾ß¡£ËüÃÇ¿ÉÒÔÈÃÄã´Ó±¸·ÝÎļþÖгéÈ¡»òÊǶÁÈ¡µ¥¸ö±í ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ