Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

ÁÙʱ±íÔÚSQL ServerºÍMySqlÖд´½¨µÄ·½·¨

SQL Server´´½¨ÁÙʱ±í£º
´´½¨ÁÙʱ±í
·½·¨Ò»£º
create table #ÁÙʱ±íÃû(×Ö¶Î1 Ô¼ÊøÌõ¼þ,
×Ö¶Î2 Ô¼ÊøÌõ¼þ,
.....)
create table ##ÁÙʱ±íÃû(×Ö¶Î1 Ô¼ÊøÌõ¼þ,
×Ö¶Î2 Ô¼ÊøÌõ¼þ,
.....)
·½·¨¶þ£º
select * into #ÁÙʱ±íÃû from ÄãµÄ±í;
select * into ##ÁÙʱ±íÃû from ÄãµÄ±í;
×¢£ºÒÔÉϵÄ#´ú±í¾Ö²¿ÁÙʱ±í£¬##´ú±íÈ«¾ ......

oracle ÓÅ»¯Ö® ÕÒ³öµÍЧÂÊsql Óï¾ä

SELECT EXECUTIONS , DISK_READS, BUFFER_GETS,
¡¡¡¡ROUND((BUFFER_GETS-DISK_READS)/BUFFER_GETS,2) Hit_radio,
¡¡¡¡ROUND(DISK_READS/EXECUTIONS,2) Reads_per_run,
¡¡¡¡SQL_TEXT
¡¡¡¡from V$SQLAREA
¡¡¡¡WHERE EXECUTIONS>0
¡¡¡¡AND BUFFER_GETS > 0
¡¡¡¡AND (BUFFER_GETS-DISK_READS)/BUFFER_GETS ......

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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ