在本教程中,我们将向您介绍在整个教程中使用的sql示例数据库。以下数据库关系图 - hr 示例数据库:
在这个hr 示例数据库有7
个表:
employees
表存储员工的数据信息。jobs
表存储工作数据信息,包括职位和工资范围。departments
表存储部门数据信息。dependents
表存储员工的家属信息。locations
表存储公司各部门的所在位置信息。countries
表存储公司开展业务的国家/地区的数据。regions
表存储亚洲,欧洲,美洲,中东和非洲等地区的数据。 这些国家分为不同的地区。下图显示了表名称及其记录数据数量。
编号 | 表名称 | 行数 |
---|---|---|
1 | employees |
40 |
2 | dependents |
30 |
3 | departments |
11 |
4 | jobs |
19 |
5 | locations |
7 |
6 | countries |
25 |
7 | regions |
4 |
通常,要使用sql,需要安装关系数据库管理系统(rdbms)。 如果您使用过mysql,postgresql,oracle数据库,sql server或sqlite等关系数据库管理系统(rdbms),则可以使用以下对应脚本创建示例数据库。
以下sql脚本是用于在mysql中创建hr 示例数据库。
create table regions (
region_id int (11) auto_increment primary key,
region_name varchar (25) default null
);
create table countries (
country_id char (2) primary key,
country_name varchar (40) default null,
region_id int (11) not null,
foreign key (region_id) references regions (region_id) on delete cascade on update cascade
);
create table locations (
location_id int (11) auto_increment primary key,
street_address varchar (40) default null,
postal_code varchar (12) default null,
city varchar (30) not null,
state_province varchar (25) default null,
country_id char (2) not null,
foreign key (country_id) references countries (country_id) on delete cascade on update cascade
);
create table jobs (
job_id int (11) auto_increment primary key,
job_title varchar (35) not null,
min_salary decimal (8, 2) default null,
max_salary decimal (8, 2) default null
);
create table departments (
department_id int (11) auto_increment primary key,
department_name varchar (30) not null,
location_id int (11) default null,
foreign key (location_id) references locations (location_id) on delete cascade on update cascade
);
create table employees (
employee_id int (11) auto_increment primary key,
first_name varchar (20) default null,
last_name varchar (25) not null,
email varchar (100) not null,
phone_number varchar (20) default null,
hire_date date not null,
job_id int (11) not null,
salary decimal (8, 2) not null,
manager_id int (11) default null,
department_id int (11) default null,
foreign key (job_id) references jobs (job_id) on delete cascade on update cascade,
foreign key (department_id) references departments (department_id) on delete cascade on update cascade,
foreign key (manager_id) references employees (employee_id)
);
create table dependents (
dependent_id int (11) auto_increment primary key,
first_name varchar (50) not null,
last_name varchar (50) not null,
relationship varchar (25) not null,
employee_id int (11) not null,
foreign key (employee_id) references employees (employee_id) on delete cascade on update cascade
);
以下脚本用于在postgresql中创建hr 示例数据库结构。
create table regions (
region_id serial primary key,
region_name character varying (25)
);
create table countries (
country_id character (2) primary key,
country_name character varying (40),
region_id integer not null,
foreign key (region_id) references regions (region_id) on update cascade on delete cascade
);
create table locations (
location_id serial primary key,
street_address character varying (40),
postal_code character varying (12),
city character varying (30) not null,
state_province character varying (25),
country_id character (2) not null,
foreign key (country_id) references countries (country_id) on update cascade on delete cascade
);
create table departments (
department_id serial primary key,
department_name character varying (30) not null,
location_id integer,
foreign key (location_id) references locations (location_id) on update cascade on delete cascade
);
create table jobs (
job_id serial primary key,
job_title character varying (35) not null,
min_salary numeric (8, 2),
max_salary numeric (8, 2)
);
create table employees (
employee_id serial primary key,
first_name character varying (20),
last_name character varying (25) not null,
email character varying (100) not null,
phone_number character varying (20),
hire_date date not null,
job_id integer not null,
salary numeric (8, 2) not null,
manager_id integer,
department_id integer,
foreign key (job_id) references jobs (job_id) on update cascade on delete cascade,
foreign key (department_id) references departments (department_id) on update cascade on delete cascade,
foreign key (manager_id) references employees (employee_id) on update cascade on delete cascade
);
create table dependents (
dependent_id serial primary key,
first_name character varying (50) not null,
last_name character varying (50) not null,
relationship character varying (25) not null,
employee_id integer not null,
foreign key (employee_id) references employees (employee_id) on delete cascade on update cascade
);
以下脚本用于在microsoft sql server中创建hr 示例数据库结构。
create table regions (
region_id int identity(1,1) primary key,
region_name varchar (25) default null
);
create table countries (
country_id char (2) primary key,
country_name varchar (40) default null,
region_id int not null,
foreign key (region_id) references regions (region_id) on delete cascade on update cascade
);
create table locations (
location_id int identity(1,1) primary key,
street_address varchar (40) default null,
postal_code varchar (12) default null,
city varchar (30) not null,
state_province varchar (25) default null,
country_id char (2) not null,
foreign key (country_id) references countries (country_id) on delete cascade on update cascade
);
create table jobs (
job_id int identity(1,1) primary key,
job_title varchar (35) not null,
min_salary decimal (8, 2) default null,
max_salary decimal (8, 2) default null
);
create table departments (
department_id int identity(1,1) primary key,
department_name varchar (30) not null,
location_id int default null,
foreign key (location_id) references locations (location_id) on delete cascade on update cascade
);
create table employees (
employee_id int identity(1,1) primary key,
first_name varchar (20) default null,
last_name varchar (25) not null,
email varchar (100) not null,
phone_number varchar (20) default null,
hire_date date not null,
job_id int not null,
salary decimal (8, 2) not null,
manager_id int default null,
department_id int default null,
foreign key (job_id) references jobs (job_id) on delete cascade on update cascade,
foreign key (department_id) references departments (department_id) on delete cascade on update cascade,
foreign key (manager_id) references employees (employee_id)
);
create table dependents (
dependent_id int identity(1,1) primary key,
first_name varchar (50) not null,
last_name varchar (50) not null,
relationship varchar (25) not null,
employee_id int not null,
foreign key (employee_id) references employees (employee_id) on delete cascade on update cascade
);
以下脚本用于在oracle database 12c中创建hr 示例数据库结构。
create table regions (
region_id number generated by default as identity primary key,
region_name varchar2 (25) default null
);
create table countries (
country_id char (2) primary key,
country_name varchar2 (40) default null,
region_id number not null,
foreign key (region_id) references regions (region_id) on delete cascade
);
create table locations (
location_id number generated by default as identity primary key,
street_address varchar2 (40) default null,
postal_code varchar2 (12) default null,
city varchar2 (30) not null,
state_province varchar2 (25) default null,
country_id char (2) not null,
foreign key (country_id) references countries (country_id) on delete cascade
);
create table jobs (
job_id number generated by default as identity primary key,
job_title varchar2 (35) not null,
min_salary number (8, 2) default null,
max_salary number (8, 2) default null
);
create table departments (
department_id number generated by default as identity primary key,
department_name varchar2 (30) not null,
location_id number default null,
foreign key (location_id) references locations (location_id) on delete cascade
);
create table employees (
employee_id number generated by default as identity primary key,
first_name varchar2 (20) default null,
last_name varchar2 (25) not null,
email varchar2 (100) not null,
phone_number varchar2 (20) default null,
hire_date date not null,
job_id number not null,
salary number (8, 2) not null,
manager_id number default null,
department_id number default null,
foreign key (job_id) references jobs (job_id) on delete cascade,
foreign key (department_id) references departments (department_id) on delete cascade,
foreign key (manager_id) references employees (employee_id)
);
create table dependents (
dependent_id number generated by default as identity primary key,
first_name varchar2 (50) not null,
last_name varchar2 (50) not null,
relationship varchar2 (25) not null,
employee_id number not null,
foreign key (employee_id) references employees (employee_id) on delete cascade
);
以下脚本用于在sqlite中创建hr 示例数据库结构。
create table regions (
region_id integer primary key autoincrement not null,
region_name text not null
);
create table countries (
country_id text not null,
country_name text not null,
region_id integer not null,
primary key (country_id asc),
foreign key (region_id) references regions (region_id) on delete cascade on update cascade
);
create table locations (
location_id integer primary key autoincrement not null,
street_address text,
postal_code text,
city text not null,
state_province text,
country_id integer not null,
foreign key (country_id) references countries (country_id) on delete cascade on update cascade
);
create table departments (
department_id integer primary key autoincrement not null,
department_name text not null,
location_id integer not null,
foreign key (location_id) references locations (location_id) on delete cascade on update cascade
);
create table jobs (
job_id integer primary key autoincrement not null,
job_title text not null,
min_salary double not null,
max_salary double not null
);
create table employees (
employee_id integer primary key autoincrement not null,
first_name text,
last_name text not null,
email text not null,
phone_number text,
hire_date text not null,
job_id integer not null,
salary double not null,
manager_id integer,
department_id integer not null,
foreign key (job_id) references jobs (job_id) on delete cascade on update cascade,
foreign key (department_id) references departments (department_id) on delete cascade on update cascade,
foreign key (manager_id) references employees (employee_id) on delete cascade on update cascade
);
create table dependents (
dependent_id integer primary key autoincrement not null,
first_name text not null,
last_name text not null,
relationship text not null,
employee_id integer not null,
foreign key (employee_id) references employees (employee_id) on delete cascade on update cascade
);
以下脚本用于将数据加载到上面hr示例数据库创建的表中。
/*data for the table regions */
insert into regions(region_id,region_name) values (1,'欧洲');
insert into regions(region_id,region_name) values (2,'美洲');
insert into regions(region_id,region_name) values (3,'亚洲');
insert into regions(region_id,region_name) values (4,'中东和非洲');
/*data for the table countries */
insert into countries(country_id,country_name,region_id) values ('ar','阿根廷',2);
insert into countries(country_id,country_name,region_id) values ('au','澳大利亚',3);
insert into countries(country_id,country_name,region_id) values ('be','比利时',1);
insert into countries(country_id,country_name,region_id) values ('br','巴西',2);
insert into countries(country_id,country_name,region_id) values ('ca','加拿大',2);
insert into countries(country_id,country_name,region_id) values ('ch','瑞士',1);
insert into countries(country_id,country_name,region_id) values ('cn','中国',3);
insert into countries(country_id,country_name,region_id) values ('de','德国',1);
insert into countries(country_id,country_name,region_id) values ('dk','丹麦',1);
insert into countries(country_id,country_name,region_id) values ('eg','埃及',4);
insert into countries(country_id,country_name,region_id) values ('fr','法国',1);
insert into countries(country_id,country_name,region_id) values ('hk','香港',3);
insert into countries(country_id,country_name,region_id) values ('il','以色列',4);
insert into countries(country_id,country_name,region_id) values ('in','印度',3);
insert into countries(country_id,country_name,region_id) values ('it','意大利',1);
insert into countries(country_id,country_name,region_id) values ('jp','日本',3);
insert into countries(country_id,country_name,region_id) values ('kw','科威特',4);
insert into countries(country_id,country_name,region_id) values ('mx','墨西哥',2);
insert into countries(country_id,country_name,region_id) values ('ng','尼日利亚',4);
insert into countries(country_id,country_name,region_id) values ('nl','荷兰',1);
insert into countries(country_id,country_name,region_id) values ('sg','新加坡',3);
insert into countries(country_id,country_name,region_id) values ('uk','英国',1);
insert into countries(country_id,country_name,region_id) values ('us','美国',2);
insert into countries(country_id,country_name,region_id) values ('zm','赞比亚',4);
insert into countries(country_id,country_name,region_id) values ('zw','津巴布韦',4);
/*data for the table locations */
insert into locations(location_id,street_address,postal_code,city,state_province,country_id) values (1400,'2014 jabberwocky rd','26192','southlake','texas','us');
insert into locations(location_id,street_address,postal_code,city,state_province,country_id) values (1500,'2011 interiors blvd','99236','south san francisco','california','us');
insert into locations(location_id,street_address,postal_code,city,state_province,country_id) values (1700,'2004 charade rd','98199','seattle','washington','us');
insert into locations(location_id,street_address,postal_code,city,state_province,country_id) values (1800,'147 spadina ave','m5v 2l7','toronto','ontario','ca');
insert into locations(location_id,street_address,postal_code,city,state_province,country_id) values (2400,'8204 arthur st',null,'london',null,'uk');
insert into locations(location_id,street_address,postal_code,city,state_province,country_id) values (2500,'magdalen centre, the oxford science park','ox9 9zb','oxford','oxford','uk');
insert into locations(location_id,street_address,postal_code,city,state_province,country_id) values (2700,'schwanthalerstr. 7031','80925','munich','bavaria','de');
/*data for the table jobs */
insert into jobs(job_id,job_title,min_salary,max_salary) values (1,'会计师',4200.00,9000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (2,'会计经理',8200.00,16000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (3,'行政助理',3000.00,6000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (4,'主席',20000.00,40000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (5,'行政副主席',15000.00,30000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (6,'会计',4200.00,9000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (7,'财务经理',8200.00,16000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (8,'人力资源代表',4000.00,9000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (9,'程序员',4000.00,10000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (10,'市场经理',9000.00,15000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (11,'市场代表',4000.00,9000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (12,'公关代表',4500.00,10500.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (13,'采购职员',2500.00,5500.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (14,'采购经理',8000.00,15000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (15,'销售经理',10000.00,20000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (16,'销售代表',6000.00,12000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (17,'运输职员',2500.00,5500.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (18,'库存职员',2000.00,5000.00);
insert into jobs(job_id,job_title,min_salary,max_salary) values (19,'库存管理',5500.00,8500.00);
/*data for the table departments */
insert into departments(department_id,department_name,location_id) values (1,'管理',1700);
insert into departments(department_id,department_name,location_id) values (2,'市场营销',1800);
insert into departments(department_id,department_name,location_id) values (3,'采购',1700);
insert into departments(department_id,department_name,location_id) values (4,'人力资源',2400);
insert into departments(department_id,department_name,location_id) values (5,'运输',1500);
insert into departments(department_id,department_name,location_id) values (6,'it',1400);
insert into departments(department_id,department_name,location_id) values (7,'公共关系',2700);
insert into departments(department_id,department_name,location_id) values (8,'销售',2500);
insert into departments(department_id,department_name,location_id) values (9,'行政人员',1700);
insert into departments(department_id,department_name,location_id) values (10,'财务',1700);
insert into departments(department_id,department_name,location_id) values (11,'会计',1700);
/*data for the table employees */
insert into `employees` values ('100', 'steven', 'lee', 'steven.lee@h3.com', '0532-86011111', '1987-06-17', '4', '24000.00', null, '9');
insert into `employees` values ('101', 'neena', 'wong', 'neena.wong@kaops.com', '0551-4243311', '1989-09-21', '5', '17000.00', '100', '9');
insert into `employees` values ('102', 'lex', 'liang', 'lex.liang@kaops.com', '0571-87622362', '1993-01-13', '5', '17000.00', '100', '9');
insert into `employees` values ('103', 'alexander', 'lee', 'alexander.lee@kaops.com', '020-95105105', '1990-01-03', '9', '9000.00', '102', '6');
insert into `employees` values ('104', 'bruce', 'wong', 'bruce.wong@h3.com', '0371-68356666', '1991-05-21', '9', '6000.00', '103', '6');
insert into `employees` values ('105', 'david', 'liang', 'david.liang@kaops.com', '0512-67513131', '1997-06-25', '9', '4800.00', '103', '6');
insert into `employees` values ('106', 'valli', 'chen', 'valli.chen@h3.com', '0535-95105175', '1998-02-05', '9', '4800.00', '103', '6');
insert into `employees` values ('107', 'diana', 'chen', 'diana.chen@h3.com', '025-95105105', '1999-02-07', '9', '4200.00', '103', '6');
insert into `employees` values ('108', 'nancy', 'chen', 'nancy.chen@h3.com', '0531-86012520', '1994-08-17', '7', '12000.00', '101', '10');
insert into `employees` values ('109', 'daniel', 'chen', 'daniel.chen@h3.com', '021-8008207890', '1994-08-16', '6', '9000.00', '108', '10');
insert into `employees` values ('110', 'john', 'chen', 'john.chen@h3.com', '0592-2088888', '1997-09-28', '6', '8200.00', '108', '10');
insert into `employees` values ('111', 'ismael', 'su', 'ismael.su@h3.com', '029-95105688', '1997-09-30', '6', '7700.00', '108', '10');
insert into `employees` values ('112', 'max', 'su', 'max.su@h3.com', '021-95105105', '1998-03-07', '6', '7800.00', '108', '10');
insert into `employees` values ('113', 'min', 'su', 'min.su@h3.com', '027-88068888', '1999-12-07', '6', '6900.00', '108', '10');
insert into `employees` values ('114', 'avg', 'su', 'avg.su@h3.com', '0755-82328647', '1994-12-07', '14', '11000.00', '100', '3');
insert into `employees` values ('115', 'alexander', 'su', 'alexander.su@h3.com', '0431-86122222', '1995-05-18', '13', '3100.00', '114', '3');
insert into `employees` values ('116', 'shelli', 'zhang', 'shelli.zhang@kaops.com', '0771-2222222', '1997-12-24', '13', '2900.00', '114', '3');
insert into `employees` values ('117', 'sigal', 'zhang', 'sigal.zhang@h3.com', '0791-6101074', '1997-07-24', '13', '2800.00', '114', '3');
insert into `employees` values ('118', 'guy', 'zhang', 'guy.zhang@kaops.com', '0411-82603331', '1998-11-15', '13', '2600.00', '114', '3');
insert into `employees` values ('119', 'karen', 'zhang', 'karen.zhang@h3.com', '010-51019999', '1999-08-10', '13', '2500.00', '114', '3');
insert into `employees` values ('120', 'matthew', 'han', 'matthew.han@h3.com', '0574-56163111', '1996-07-18', '19', '8000.00', '100', '5');
insert into `employees` values ('121', 'max', 'han', 'max.han@h3.com', '0731-2637122', '1997-04-10', '19', '8200.00', '100', '5');
insert into `employees` values ('122', 'min', 'liu', 'min.liu@h3.com', '023-63862607', '1995-05-01', '19', '7900.00', '100', '5');
insert into `employees` values ('123', 'shanta', 'liu', 'shanta.liu@h3.com', '311-87600111', '1997-10-10', '19', '6500.00', '100', '5');
insert into `employees` values ('126', 'irene', 'liu', 'irene.liu@kaops.com', '0752-95105688', '1998-09-28', '18', '2700.00', '120', '5');
insert into `employees` values ('145', 'john', 'liu', 'john.liu@h3.com', null, '1996-10-01', '15', '14000.00', '100', '8');
insert into `employees` values ('146', 'karen', 'liu', 'karen.liu@h3.com', null, '1997-01-05', '15', '13500.00', '100', '8');
insert into `employees` values ('176', 'jonathon', 'yang', 'jonathon.yang@h3.com', null, '1998-03-24', '16', '8600.00', '100', '8');
insert into `employees` values ('177', 'jack', 'yang', 'jack.yang@h3.com', null, '1998-04-23', '16', '8400.00', '100', '8');
insert into `employees` values ('178', 'kimberely', 'yang', 'kimberely.yang@h3.com', null, '1999-05-24', '16', '7000.00', '100', '8');
insert into `employees` values ('179', 'charles', 'yang', 'charles.yang@h3.com', null, '2000-01-04', '16', '6200.00', '100', '8');
insert into `employees` values ('192', 'sarah', 'yang', 'sarah.yang@kaops.com', '0351-2233611', '1996-02-04', '17', '4000.00', '123', '5');
insert into `employees` values ('193', 'britney', 'zhao', 'britney.zhao@h3.com', '0351-2233611', '1997-03-03', '17', '3900.00', '123', '5');
insert into `employees` values ('200', 'jennifer', 'zhao', 'jennifer.zhao@h3.com', '021-66050000', '1987-09-17', '3', '4400.00', '101', '1');
insert into `employees` values ('201', 'michael', 'zhou', 'michael.zhou@h3.com', '010-67237328', '1996-02-17', '10', '13000.00', '100', '2');
insert into `employees` values ('202', 'pat', 'zhou', 'pat.zhou@h3.com', '0755-28114518', '1997-08-17', '11', '6000.00', '201', '2');
insert into `employees` values ('203', 'susan', 'zhou', 'susan.zhou@h3.com', '0755-83587526', '1994-06-07', '8', '6500.00', '101', '4');
insert into `employees` values ('204', 'hermann', 'wu', 'hermann.wu@h3.com', '0513-83512816', '1994-06-07', '12', '10000.00', '101', '7');
insert into `employees` values ('205', 'shelley', 'wu', 'shelley.wu@h3.com', '0898-31686222', '1994-06-07', '2', '12000.00', '101', '11');
insert into `employees` values ('206', 'william', 'wu', 'william.wu@h3.com', '022-26144822', '1994-06-07', '1', '8300.00', '205', '11');
/*data for the table dependents */
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (1,'penelope','wu','child',206);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (2,'nick','wu','child',205);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (3,'ed','zhao','child',200);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (4,'jennifer','lee','child',100);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (5,'johnny','wong','child',101);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (6,'bette','liang','child',102);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (7,'grace','chen','child',109);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (8,'matthew','chen','child',110);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (9,'joe','su','child',111);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (10,'christian','su','child',112);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (11,'zero','su','child',113);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (12,'karl','chen','child',108);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (13,'uma','zhou','child',203);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (14,'vivien','lee','child',103);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (15,'cuba','wong','child',104);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (16,'fred','liang','child',105);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (17,'helen','chen','child',106);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (18,'dan','chen','child',107);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (19,'bob','zhou','child',201);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (20,'lucille','zhou','child',202);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (21,'kirsten','wu','child',204);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (22,'elvis','su','child',115);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (23,'sandra','zhang','child',116);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (24,'cameron','zhang','child',117);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (25,'kevin','zhang','child',118);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (26,'rip','zhang','child',119);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (27,'julia','su','child',114);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (28,'woody','liu','child',145);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (29,'alec','liu','child',146);
insert into dependents(dependent_id,first_name,last_name,relationship,employee_id) values (30,'sandra','yang','child',176);
以下是用于刷新示例数据库时,删除所有表的脚本。
drop table employees;
drop table dependents;
drop table departments;
drop table locations;
drop table countries;
drop table regions;
drop table jobs;