//起别名
SELECT `id` 账号,`title` 姓名 from edu_chapter;
//去重
SELECT DISTINCT teacher_id from edu_comment;
//将id和nickname两个字段拼接,并起别名
SELECT CONCAT(id,nickname) as 姓名 from edu_comment
//模糊查询的两种方式
SELECT DISTINCT * from edu_comment WHERE nickname LIKE '%1%'
SELECT nickname from edu_comment WHERE nickname LIKE '_____1%'
//使用in插入查询
SELECT * from edu_chapter WHERE id in ('1','2','3','4')
//安全等于
SELECT * from edu_course WHERE teacher_id <=>null
MySQL简单语句
最新推荐文章于 2022-04-02 13:07:24 发布