在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)
热门推荐
1 狗狗技能训练
5 如何训练狗狗笑
6 狗狗训练排便
9 狗狗响片训练
10 如何训练狗狗不捡食
11 狗狗尿训练
12 怎么训练狗狗找东西
13 狗狗训练站立
14 狗狗训练飞盘
15 鞍山狗狗训练
16 怎样训练泰迪狗狗谢谢
17 狗狗外出训练
18 怎么训练金毛狗狗大小便