- 在MySQL中如果有两个语句要输出结果则,可在下面框中选择结果2来查看结果
2、获取当前系统日期的函数:NOW(),获取年份的函数:year();
3、查询年龄最大的学生姓名及其年龄:
select name,max(age) as age_max from test;
select name,max(age) as 最大年龄 from test;
不同的机器系统对语句的识别不同,某些语句能接受中文;
select * from test where age>=20;【如果改写成>_=则报错,因为>和=为两种运算符】
select * from test where age<=20;
每个关键字、词之间需要用空格隔开;
select * from test where age between 20 and 22搜索年龄为20和22的学生姓名;
select * from test where age<=22 and age>=20;
4、用like运算符计通配符【%】实现模糊查询,=为精确查询;
5、查找性王的:select * from test where name like '王%';【%表示后面有任意多个字符】