博主最近临近实习风口,在学校抓紧复习学习了一下mysql 查询的基础语句,总结了一下。
1.字符串链接函数:concat()
select concat(name,'=>',score) from student;
2.文本处理函数:trim、locate、upper、lower、substring
3.运算符:+、-、*、\、>、<、>=、<=、<>
4.时间函数:DATE()、CURTIME()、DAY()、YEAR()、NOW()
5.逻辑运算符:and 、or、 not
6.null运算符:isNull、is not null
7.between关键字
#在什么之间(a和b之间的数据,包括a和b)
select * from student where id between 1 and 3;
8.select 单表子查询(返回一个对象)
select * from student where age = (select max(age) from student);
9.in关键字
#查询出包含的数据
select * form student where id in(1,2,3,4);