摘要: 左关联(只要主表有的数据都会展示出来) select * from tb_user u(主表) left join tb_class c (从表)on u.id=c.id; 通过id把两个表id相同的数据连接起来 中关联(后表没有的数据不会展示出来) select * from tb_user u 阅读全文
posted @ 2021-04-12 19:22 终末s 阅读(98) 评论(0) 推荐(0)
摘要: select * from 表名; 查询该表下所有数据 select * from 表名 where 条件; 查询满足某条件的数据 select * from tb_user where id>2; 模糊查询 like (_(占位符)、%(通配符)) select * from tb_user wh 阅读全文
posted @ 2021-04-12 17:06 终末s 阅读(220) 评论(0) 推荐(0)
摘要: 新增数据 语法 insert into 表名 (字段名1,字段名2,...) values (值1,值2,...) insert into tb_user (id,`name`) values (1,"张三"); 非空列必须填写,如不填写则会报错 简写(values要写入所有字段,如少一个则报错) 阅读全文
posted @ 2021-04-12 16:57 终末s 阅读(220) 评论(0) 推荐(0)
摘要: 创建数据库 create database 数据库名; use 数据库名; 使用数据库 show databases; 展示所有的数据库 创建表## create table 表名 (字段名 类型(长度) <约束,默认值,注释>) 约束 ##非空 NOT NULL 不能为空 ##非负 UNSIGNE 阅读全文
posted @ 2021-04-12 13:55 终末s 阅读(54) 评论(0) 推荐(0)