数据库SQL 编辑器编写 SQL 查询语句
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
数据库系统原理实验报告
一、实验目的
了解 PostgreSQL 查询编辑器的启动,熟悉如何在 PostgreSQL 查询编辑器查询记录。
掌握 SELECT 语句的基本语法和查询条件表示方法
掌握 GROUP BY 和 ORDER BY 子句的作用和使用方法
掌握连接查询和子查询的使用方法
加深对 SQL 数据更新(插入、修改及删除)语句的基本语法格式的掌握掌握单个元组及多个元组的插入、修改及删除操作的实现过程
加深对更新操作时数据库中数据一致性问题的了解
加深对约束条件在数据更新操作执行中的作用问题的了解
二、实验内容
使用 SQL 编辑器编写 SQL 查询语句
使用 SQL 编辑器编写 SQL 数据更新语句
三、实验任务
1.对上节建立的表输入数据:
(1)departments:
代码:
Insert into
departments_1511630117(DepartmentID,DepartmentName,Note) values('1','财务部','财务部');
insert into
departments_1511630117(DepartmentID,DepartmentName,Note) values('2','研发部','研发部');
insert into
departments_1511630117(DepartmentID,DepartmentName,Note) values('3','人力资源部','人力资源部')
(2)Employee:
代码:
insert into employee_1511630117(employeeid,name,birthday,sex,address,zip,phonenumber,emailaddress,d epartmentid)
values('1001','李勇','19780312','0','河南','475001','3880378','ly@','1');
insert into employee_1511630117(employeeid,name,birthday,sex,address,zip,phonenumber,emailaddress,d epartmentid)
values('1002','王敏','19801102','1','河南','475002','0378311','wm@','1');
insert into employee_1511630117(employeeid,name,birthday,sex,address,zip,phonenumber,emailaddress,d epartmentid)
values('1003','刘晨','19780622','0','河南','475003','0378322','le@','1');
insert into employee_1511630117(employeeid,name,birthday,sex,address,zip,phonenumber,emailaddress,d epartmentid)
values('2001','张立','19780801','0','河南','475004','0378333','zl@','2');
insert into employee_1511630117(employeeid,name,birthday,sex,address,zip,phonenumber,emailaddress,d epartmentid)
values('2002','刘毅','19820123','0','河南','475005','0378344','ly@','2');
insert into employee_1511630117(employeeid,name,birthday,sex,address,zip,phonenumber,emailaddress,d
epartmentid)
values('2003','张玫','19810315','1','河南','475006','0378355','zm@','2');
insert into employee_1511630117(employeeid,name,birthday,sex,address,zip,phonenumber,emailaddress,d epartmentid)
values('3001','徐静','19760812','1','河南','475007','0378366','xj@','3');
insert into employee_1511630117(employeeid,name,birthday,sex,address,zip,phonenumber,emailaddress,d epartmentid)
values('3002','赵军','19790219','0','河南','475008','0378377','zj@','3')
(3)Salary:
代码:
insert into salary_1511630117(employeeid,income,outcome)
values('1001','3600','1500');
insert into salary_1511630117(employeeid,income,outcome)
values('1002','3300','1000');
insert into salary_1511630117(employeeid,income,outcome)
values('1003','3700','1200');
insert into salary_1511630117(employeeid,income,outcome)
values('2001','4000','1600');
insert into salary_1511630117(employeeid,income,outcome)
values('2002','3800','1800');