数据库作业

来源:百度知道 编辑:UC知道 时间:2024/05/18 00:15:53
一个网站的答疑区数据库包含两个表:
用户信息表:user(uname,urname,upassword,uemail)
user由用户名(uname),用户真实姓名(urname),密码(upassword),电子邮件(ueamil)四个属性组成,其中uname为主码。
问题信息表:problem(pnum,ptitle,pdisb,uname,ptime)
problem由问题编号(pnum) 、问题标题(ptitle)、问题描述(pdisb)、提问者(uname)、提问时间(ptime) 五个属性组成,其中pnum 为主码。
写出以下查询的语句:
1 . 查询user表所有用户的信息。
2 . 查询所有用户的用户名和密码。
3 . 查询问题编号在30到60之间的所有记录。
4 . 查询提问者为“张三”的所有问题记录。
5 . 查询提问时间在“0702”(七月二日)的所有问题提问者的用户信息。

select * from user

select uname,upassword from user

select * from problem where pnum>=30 and pnum<=60

select pnum,ptitle,pdisb,uname,ptime from problem
where user.uname='张三'

select user.uname,urname,upassword,uemail from user,problem
where user.uname=problem.uname and ptime='0702'

1.select * from user
2.select uname,upassword from user
3.select * from problem where pnum>=30 and pnum<=60
4.select * from problem where uname='张三'
5.select * from user where uname=(select uname from problem where ptime='2007-07-02')