mysql 千峰第二阶段 8 (多表联查)

mysql 千峰第二阶段 8 (多表联查)

 

 mysql 千峰第二阶段 8 (多表联查)

 

 mysql 千峰第二阶段 8 (多表联查)

mysql 千峰第二阶段 8 (多表联查)

mysql> create table dep(id int auto_increment primary key,name varchar(32) not null default '')charset=utf8;
Query OK, 0 rows affected (0.10 sec)

mysql> insert into dep(name) values ('yanfabu'),('yunweibu'),('xingzhengbu'),('shichangbu');
Query OK, 4 rows affected (0.05 sec)
Records: 4 Duplicates: 0 Warnings: 0

mysql> select * from dep;
+----+-------------+
| id | name |
+----+-------------+
| 1 | yanfabu |
| 2 | yunweibu |
| 3 | xingzhengbu |
| 4 | shichangbu |
+----+-------------+
4 rows in set (0.00 sec)

mysql> create table userinfo(id int auto_increment primary key,name varchar(32) not null default '',depart_id int not null default 1,constraint fk_user_depart foreign key (depart_id) references dep(id)) charset=utf8;

 

上一篇:剑指 Offer 09. 用两个栈实现队列


下一篇:09-Java方法01~03