选择DDL查看语句
5.2、多表
建用户信息表【userInfo】,注:id无需点击自增
【ctrl+s】保存,表名为【userInfo】
复制测试sql:
INSERT INTO users VALUES (0,NOW(),'admin','123456');
INSERT INTO users VALUES (0,NOW(),'zhangsan','123456');
INSERT INTO users VALUES (0,NOW(),'lisi','123456');
INSERT INTO users VALUES (0,NOW(),'afanti','123456');
INSERT INTO users VALUES (0,NOW(),'wangerniu','123456');
INSERT INTO users VALUES (0,NOW(),'maomao','123456');
INSERT INTO userinfo VALUES (1,0,18,'河北省石家庄','赚钱');
INSERT INTO userinfo VALUES (2,1,18,'山西省太原市','喝酒');
INSERT INTO userinfo VALUES (3,1,18,'北京市昌平区','唱歌');
INSERT INTO userinfo VALUES (4,1,18,'上海市','凡尔赛');
INSERT INTO userinfo VALUES (5,0,18,'浙江省杭州市','裙子');
INSERT INTO userinfo VALUES (6,0,18,'*省乌鲁木齐市','放牧');
SELECT * FROM users;
SELECT * FROM userinfo;
SELECT * FROM users INNER JOIN userinfo ON users.id=userinfo.uid;