1、 打開數據庫YGGL;
Use yggl;
2、 向Employees表中插入一條記錄:000001 王林 大專 1966-01-23 1 8 中山路32-1-508 83355668 2;
Insert into employees values (
‘000001’,’王林’,’大專’,’1966-1-23’,’1’,8,’中山路32-1-508’,’83355668’,’2’);
3、 向Employees表中插入一條記錄:其中員工編號為010008,姓名伍容華,學歷本科,出生日期1976-03-28,性別男,部門號1;
Insert into employees values (
‘010008’, ’伍容華’, ’本科’, ’ 1976-03-28’, ’1’,3,’北京東路100-2’,’833211321’,’1’);
4、 使用界面工具將Departments表和Salary表中的數據輸入,將Employees表中的前4條記錄插入;
5、 刪除Salary表中編號為102201的工資信息;
Delete from employees where employeeid=’102201’;
6、 使用insert…set向Salary表中添加記錄:000001 2100.8 123.09;
Insert into salary set employeeid=’000001’,income=2100.8,outcome=123.09;
7、 使用replace向Departments中添加記錄:5 廣告部 負責產品推廣;
Replace into departments values (‘5’,’廣告部’,’負責推廣產品’);
8、 復制新表Departments1,要求結構與Departments表相同;
Create table departments1 like departments;
9、 復制新表Salary1,要求數據與Salary相同;
Create table salary1 as (select * from salary);
.
10、 修改表employees,將編號為020018的部門號修改為4;
Update employees
Set departmentid=4
Where employeeid = ’020018’ ;
11、 將所有職工的工資收入增加500元;
Update salary
Set income=income+500;
12、 使用多表修改將“張石兵”的工資收入增加500元;
Update salary,employees
Set income=income+500
Where name=’ 張石兵’;
13、 使用多表刪除將“王林”的工資信息刪除;
Delete salary,employees
From salaryemployees
Where name=’ 王林’;
14、 使用truncate table刪除Salary表中的所有行。
Truncate table salary;