一、
给定的“HumanResourceM”数据库中的数据库表结构及样本记录表1-表6。
过年的歌曲1.向Employee表中添加记录(’201’,任敏’,’女’,’25’,’无’,’人力资源部’)。
答:INSERT INTO Employee (EmployeeID,EName,Sex,Age,Position,Dept)
V ALUES (’201’,’任敏’,’女’,’25’,’无’,’人力资源部’);
2.查询奖金超过10000元(不包含10000元),实发工资小于100000元(不包含100000万元)的工资记录。
万茜老公谁答:SELECT * FROM Salary WHERE Bonus>10000 AND NetPayment<100000;
3.查询刘丽的工作状况。
答:SELECT WorkStatus.EmployeeID, WorkStatus. Position, WorkStatus. AssessmentYear, WorkSt
atus. JobPerformance, WorkStatus. DateofAppointment FROM WorkStatus INNER JOIN Employee ON WorkStatus. EmployeeID = Employee. EmployeeID WHERE Employee.EName=’刘丽’ ;
4.查询员工的平均工资。
答:SELECT EmployeeID, A VG(NetPayment) FROM Salary GROUP BY EmployeeID ;
唐高宗的儿子5.查询2020年度优秀的员工的个人详细信息(包括姓名、性别、年龄等。)答:SELECT Employee. EName, Employee. Sex, Employee. Age FROM Employee INNER JOIN WorkStatus ON Employee. EmployeeID=WorkStatus. EmployeeID WHERE WorkStatus. JobPerformance =’优秀’ ;
6.删除记录(’003’,’财务部经理’,’2020’,’良好’,’2020-01-01’)。答:DELETE FROM WorkStatus where EmployeeID='003'and Position=’财务部经理’AND AssessmentYear=’ 2020’ AND JobPerformance=’良好’AND DateofAppointment=’2020-01-01’;
二、
给定的“Library”数据库中的数据库表结构及样本记录表1-表6,数据如下:
1.向books表中添加数据(’00008’,‘数据库原理及应用:Access 2003’,’庞振平’,’2021-02-01’,’华南理工大学出版社’)
答:INSERT INTO books V ALUES (’00008’,‘数据库原理及应用:Access 2003’,’ 庞振平’,’ 2021-02-01’,’ 华南理工大学出版社’);苗苗图片 个人资料
2.查询男性读者信息。
答:SELECT * FROM readers WHERE Sex=’男’;
3.查询读者’001’借阅图书的详细信息(包括书名、作者、出版社、出版时间)。答:SELECT books. BookName, books. Author, books. APublishIns, books. PublishTime FROM books INNER JOIN borrow ON books. BookID = borrow. BookID WHERE borrow. ReaderID =’001’ ;
4.统计机械工业出版社图书的种类。张嘉译的老婆是谁
答:SELECT DISTINCT Name FROM books WHERE PublishIns =’ 械工业出版社’;
5.查询未归还的图书的详细信息。
答:SELECT books.BookID,books. BookName, books. Author, books. APublishIns, books. PublishTime FROM books INNER JOIN borrow ON books. BookID = borrow. BookID WHERE borrow. ReturnDate IS NULL;
正青春章小鱼和谁在一起了6.在读者信息表readers中,增加专业“Major”字段,结构如下:
答:添加字段:ALTER TABLE readers ADD Major varchar(20)NULL;
添加说明:EXECUTE sp_addextendedproperty N'MS_Description','读者所在专业',N' readers ',N'dbo',N'table',N'表',N'column',N'Major';
发布评论