《数据库练习答案.pdf》由会员分享,可在线阅读,更多相关《数据库练习答案.pdf(9页珍藏版)》请在三一文库上搜索。
1、. . 一. 创建一个学生档案表(表名为 xsda),其表结构如下: 列名类型长度允许空备注 Xh Char 10 学号 Xm Char 8 姓名 csny Datetime 出生年月 Gz Decimal 6 工资 Zy Char 10 专业 Create Table xsda ( xh Char (10) not null unique, xm Char(8), csny Datetime , gz Decimal(6,1), zy Char (10) ) 1.在 xsda 表中插入一个学生记录:(2000jsj008,李平) insert into xsda(xh,xm) values(
2、 2000jsj008 , 李平 ) 2.把 xsda 表中 80-01-01 前出生的人的工资增加20% Update xsda set gz=gz*1.2 where csny1970-01-01 5、 查询工资高于2000 元的员工的信息。 Select * from employee where Salary2000 6、 查询系统集成部的所有员工的信息。 Select employee.* from employee,departments where employee. Depart=departments. Depdid and Depname= 系统集成部 7、 统计软件开发部
3、的人均工资 select avg(salary) from employee, departments where employee. Depart=departments. Depdid and Depname= 软件开发部 8、 查询所有员工中工资最高和最低的人。 Select * from employee where saraly=(select max(saraly) from employee) go Select * from employee where saraly=(select min(saraly) from employee) 9、 统计软件开发部的人数。 select count(*) from employee, departments where employee. Depart=departments. Depdid and Depname= 软件开发部 10、 将所有员工的工资上调10% 。 Update employee set gz=gz*1.2 11、 将工资收入低于2500 元的员工每人加薪200 元。 Update employee set gz=gz+200 where saray50 14、删除所有1970 年以前出生的员工的信息。 Delete from employee where birthdate1970-01-01