2025-06-27 16:57:29
MySQL的查询语句书写遵循严格规则,务必注意:
例如计算百分比成绩:
`select 学号,成绩,成绩/100 as '百分比成绩' from score;`
`select distinct 姓名 from student;`
单行:`-- 查询出全部列
select * from student;`
多行:`/*
查找姓名为'猴子'的学号
*/
select 姓名,学号 from student where 姓名='猴子';`
`姓名包含'猴子':
`select * from student where 姓名 like '猴%'`
`SELECT name
FROM world
WHERE name LIKE '%a%'
AND name LIKE '%e%'
AND name LIKE '%i%'
AND name LIKE '%o%'
AND name LIKE '%u%'
AND name NOT LIKE '% %';`