MySQL学习日记
究极无敌战神
这个作者很懒,什么都没留下…
展开
-
MySQL查询某成绩前3的学生信息
-- 分页 limit 起始值,页面大小-- 每页5条数据 SELECT * FROM STUDENT ORDER BY SID LIMIT 0,5 -- 第一页SELECT * FROM STUDENT ORDER BY SID LIMIT 5,5 -- 第二页#SELECT * FROM STUDENT ORDER BY SID LIMIT (N-1)*页面大小,页面大小 -- 第N页-- 查找math成绩前三名且成绩大于70的学生学号姓名和math成绩从高到低SELECT stu...原创 2021-11-16 15:00:34 · 7160 阅读 · 0 评论 -
MySQL升序,降序
ORDER BY 字段 DESC/ASC# 默认按照升序 ASC可以不写SELECT * FROM STUDENT ORDER BY SAGE ASC# 降序 DESCSELECT * FROM STUDENT ORDER BY SAGE DESC原创 2021-11-16 14:42:52 · 852 阅读 · 0 评论 -
个人MySQL小记
Concat(a,b)函数SELECT CONCAT('姓名:',NAME) AS 名单 FROM student;去重SELECT DISTINCT sage FROM student对值运算SELECT sid AS 学号, sage+1 AS 年龄 FROM student原创 2021-11-15 22:15:39 · 328 阅读 · 0 评论 -
MySQL日记之Where语句
逻辑运算符and && a and b a&&b 2个为真才是真 or || a orb a||b 一个是真就是真 not ! not a !a 真为假,假为真SELECT SID FROM STUDENT WHERE sid>2 AND Sage<=22SELECT *...原创 2021-11-16 09:42:13 · 260 阅读 · 0 评论 -
MySQL like in null
-- like %0到任意个字符 一个下划线_代表一个字符SELECT * FROM student WHERE NAME LIKE '孙%'SELECT * FROM student WHERE NAME LIKE '孙_'SELECT * FROM student WHERE NAME LIKE '孙__'SELECT * FROM student WHERE NAME LIKE '%水%'-- inSELECT * FROM STUDENT WHERE SID IN(7,...原创 2021-11-16 09:55:17 · 676 阅读 · 0 评论