1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| create table dept(
id serial primary key,
name varchar(20)
)
create table employee1(
id serial primary key,
name varchar(20),
age int,
salary real,
dept_id int references dept (id)
)
insert into dept (name) values('人事部');
insert into dept (name) values('财务部');
insert into dept (name) values('公关部');
insert into dept (name) values('总经理办公室');
insert into employee1 values(DEFAULT,'小乔',18,10000,1);
insert into employee1 values(DEFAULT,'大乔',19,10000,1);
insert into employee1 values(DEFAULT,'曹操',20,12000,2);
insert into employee1 values(DEFAULT,'周瑜',21,13000,3);
insert into employee1 values(DEFAULT,'刘备',22,14000,4);
select * from dept;
|