在MySQL中查找分数超过特定分数的学生的记录吗?
使用WHERE进行设置,可以获得比特定分数更多的学生记录。让我们首先创建一个表-
mysql> create table DemoTable
-> (
-> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> StudentName varchar(100),
-> StudentScore int
-> );
mysql> insert into DemoTable(StudentName,StudentScore) values('Sam',48);
mysql> insert into DemoTable(StudentName,StudentScore) values('Chris',33);
mysql> insert into DemoTable(StudentName,StudentScore) values('Robert',89);使用select语句显示表中的所有记录-
mysql> select *from DemoTable;
输出结果
这将产生以下输出-
+----+-------------+--------------+ | Id | StudentName | StudentScore | +----+-------------+--------------+ | 1 | John | 43 | | 2 | Sam | 48 | | 3 | Chris | 33 | | 4 | Robert | 89 | +----+-------------+--------------+ 4 rows in set (0.00 sec)
以下是查询以获取分数超过45分的学生的记录-
mysql> select StudentName from DemoTable where StudentScore > 45;
输出结果
这将产生以下输出-
+-------------+ | StudentName | +-------------+ | Sam | | Robert | +-------------+ 2 rows in set (0.00 sec)
热门推荐
9 家长会简短祝福语
10 新年祝福语姨姨简短
11 送朋友搞笑简短祝福语
12 婆婆66岁祝福语简短
13 新年祝福语大全牛年 简短
14 最佳元旦祝福语简短学校
15 离别赠言离职祝福语简短
16 春节红包祝福语大全简短
17 哈尼族祝福语简短
18 立春祝福语简短微信