上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 36 下一页
摘要: 创建数据库 create database if not exists books; 删除数据库 drop database if exists books; 显示所有数据库 show databases; 显示数据库所有表 show tables; 创建数据表 DROP TABLE IF EXIS 阅读全文
posted @ 2021-07-11 14:54 胡勇健 阅读(50) 评论(0) 推荐(0)
摘要: 语法 delete from 表名 where 筛选条件 实例 delete from student where `id`= 7; 语法 truncate table 表名 实例 truncate table student; 阅读全文
posted @ 2021-07-11 14:12 胡勇健 阅读(385) 评论(0) 推荐(0)
摘要: 语法 update 表名 set 列=值,列=值... where 筛选条件 实例 update student set `age`=32 where `id`=10; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Wa 阅读全文
posted @ 2021-07-11 14:00 胡勇健 阅读(1551) 评论(0) 推荐(0)
摘要: 语法1 insert into 表名(列名,...) values(值1,...); 实例 insert into student(`name`,`sex`,`age`,`class_id`,`status`) values('胡勇健','男',28,1,1); Query OK, 1 row af 阅读全文
posted @ 2021-07-11 13:41 胡勇健 阅读(833) 评论(0) 推荐(0)
摘要: 语法 select 列 from 表 【join type] join on 连接条件 where 筛选条件 group by 分组字段 having 分组后筛选 order by 排序字段 limit offset, size; 分页实例 select * from student limit 0 阅读全文
posted @ 2021-07-11 13:13 胡勇健 阅读(89) 评论(0) 推荐(0)
摘要: 实例 SELECT * FROM student WHERE class_id IN ( SELECT id FROM class WHERE id = 2 ); + + + + + + + | id | name | sex | age | class_id | status | + + + + 阅读全文
posted @ 2021-07-11 12:36 胡勇健 阅读(45) 评论(0) 推荐(0)
摘要: 连接语法 select 字段 from 表名1,表名2 where 表名1.key = 表名2.key [group by 字段] [having 条件] [order by 字段 [desc|asc]] select 字段... from 表名1 【连接类型】join 表名2 on 表名1.key 阅读全文
posted @ 2021-07-10 09:36 胡勇健 阅读(77) 评论(0) 推荐(0)
摘要: if 函数 select if(2>1, '是2','是1') 字段; + + | 字段 | + + | 是2 | + + 1 row in set (0.00 sec) case 语句 select age, case age when 18 then '今年成年' when 30 then '今 阅读全文
posted @ 2021-07-08 10:26 胡勇健 阅读(32) 评论(0) 推荐(0)
摘要: 字符函数 length 获取字符串长度 select length('huyongjian') length; + + | length | + + | 10 | + + 1 row in set (0.00 sec) concat 连接字符串 select concat(id,'_',name) 阅读全文
posted @ 2021-07-08 09:56 胡勇健 阅读(54) 评论(0) 推荐(0)
摘要: mysql 查询语句 select * from school; 指定查询列 select id,name from school; 起别名 select id,name as 姓名,sex as 性别,age as 年龄 from student; 去重查询 select distinct sex 阅读全文
posted @ 2021-07-07 01:31 胡勇健 阅读(136) 评论(0) 推荐(0)
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 36 下一页