image.png

    1. create database db2 default charset utf8 collate utf8_general_ci;
    1. mysql> use db2;
    2. create table depart(
    3. id int not null auto_increment primary key,
    4. title varchar(16) not null
    5. )default charset=utf8;
    6. create table info(
    7. id int not null auto_increment primary key,
    8. name varchar(16) not null,
    9. email varchar(32) not null,
    10. age int,
    11. depart_id int
    12. )default charset=utf8;
    1. insert into depart(title) values("开发"),("运营"),("销售");
    2. insert into info(name,email,age,depart_id) values("mufeng","598779784@qq.com",19,1);
    3. insert into info(name,email,age,depart_id) values("gini","gini@live.com",49,1);
    4. insert into info(name,email,age,depart_id) values("deepwind","deepwind@live.com",9,2);
    5. insert into info(name,email,age,depart_id) values("tony","tony@live.com",29,1);
    6. insert into info(name,email,age,depart_id) values("kelly","kelly@live.com",99,3);
    7. insert into info(name,email,age,depart_id) values("james","james@live.com",49,1);
    8. insert into info(name,email,age,depart_id) values("gailun","gailun@live.com",49,1);