发布网友 发布时间:2022-04-23 21:39
共2个回答
热心网友 时间:2023-06-27 05:31
2. Create Table Players
(PNO char(2) Primary key,
PName char(20),
PBirthday datetime CHECK(PBirthday>'1985-1-1' and PBirthday<'1993-12-31'),--这里我是sqlserver,用的datetime,你可以根据具体数据库选用合适类型
Pcity char(20) Default '上海',
Telephone char(20)
);
Create Table Balls
(PNO char(2) Primary key,
Cdate datetime NOT NULL,
EBalls integer NOT NULL,
FOREIGN KEY(PNO)references Players(PNO)
);
3. Update Players SET PNO ='20'where PName='孙鑫';
4. Delete From Balls where PNO in(SELECT PNO FROM Players where PName='姚爽');
5. SELECT PNO,SUM(EBalls) FromBalls GROUP BY PNO ORDER BY SUM(EBalls) DESC;
6. SELECT PNO,PNAME,PBirthday,PCity,Telephone FROM Players where PBirthday>'1990-01-01' and PName like '%兵%';
7. Create view v1
As
SELECT Players.PNO,PName,PBirthday,Telephone,Cdate,EBalls FROM Players,Balls Where Players.PNO= Balls.PNO
8. Update Players SET Telephone = '010-'+ Telephone where PCity = '北京';
9. SELECT PName,PCity,PBirthday,Telephone,Cdate,COUNT(EBalls)
From Players,Balls
Where Players.PNO=Balls.PNO
and Players.PName like '孙%'
Group by Players.PName,PCity,PBirthday,Telephone,Cdate,Players.PNO
Order by Players.PNO ASC,COUNT(EBalls) DESC ;
总结:
所有的''都要用英文的,其中有细节的调整,你可以仔细看看
第10条没看明白是什么
热心网友 时间:2023-06-27 05:32
没发现问题,除了语句要写标准,比如说from 表中间有空格,and 前后面都有空格,10. ΠPName,PBirthday,Cdate,EBalls(σPCity=’广州’(Players▶` Balls))不知道是什么意思