一、
讓客戶(hù)滿(mǎn)意是我們工作的目標(biāo),不斷超越客戶(hù)的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶(hù),將通過(guò)不懈努力成為客戶(hù)在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:主機(jī)域名、網(wǎng)頁(yè)空間、營(yíng)銷(xiāo)軟件、網(wǎng)站建設(shè)、赤峰網(wǎng)站維護(hù)、網(wǎng)站推廣。
1.新建表 test
id varchar2(20)
name varchar2(20)
addr varchar2(50)
score number
create table test
(id varchar2(20),
name varchar2(20),
addr varchar2(50),
score number
)
2.給id增加主鍵約束
alter table test add constraint pk_id primary key(id)
3.查詢(xún)出分?jǐn)?shù)大于60分的人員,并按分?jǐn)?shù)降序進(jìn)行排列
select * from test where score>60 order by score desc
4.新增數(shù)據(jù) 001 zhangsan shenzhen 80
insert into test(id,name,addr,score) values ('001','zhansgan','shenzhen','80')
7.刪除zhangsan的信息
delete from test where name='zhangsan'
二、
Student(S#,Sname,Sage,Ssex) 學(xué)生表
Course(C#,Cname,T#) 課程表
SC(S#,C#,score) 成績(jī)表
Teacher(T#,Tname) 教師表
問(wèn)題:
1、查詢(xún)平均成績(jī)大于60分的同學(xué)的學(xué)號(hào)和平均成績(jī); avg
select s#,avg(score) from sc where (select avg(score) from sc)>60 group by s# ;
select s#,avg(score) from sc where group by s# having avg(score)>60;
2、查詢(xún)所有同學(xué)的學(xué)號(hào)、姓名、選課數(shù)、總成績(jī);
select Student.s#,sname,count(C#),sum(score) from Student inner join sc on Student.s#=sc.s# group by Student.s#,sname
3、查詢(xún)姓“李”的老師的個(gè)數(shù);
select count(*) from teacher where tname like'李%'
4、查詢(xún)沒(méi)學(xué)過(guò)“葉平”老師課的同學(xué)的學(xué)號(hào)、姓名;
select S#,Sname from Student where s# in (select S# from sc where c# not in (select c# from Course where T#=(select T# from teacher where Tname='葉平' ))
5、查詢(xún)所有課程成績(jī)小于60分的同學(xué)的學(xué)號(hào)、姓名;
select S#,Sname from Student where s# not in (select S# from sc where score>60)