选择具有特定范围 sql 查询的行 [英] Select rows with in particular range sql query
本文介绍了选择具有特定范围 sql 查询的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一张如下表.
它存储学生详细信息.
我想要一个 sql 查询来让年龄在 15 到 27 岁之间的学生姓名.
I want a sql query to have students Name who are between age 15 and 27.
CREATE TABLE Students(Sno INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Name VARCHAR(255), Age_Start INT, Grade VARCHAR(255)); INSERT INTO Students(Name, Age_Start, Grade) VALUES('Student 1', 10, 'Grade A'), ('Student 2', 15, 'Grade B'), ('Student 3', 18, 'Grade C'), ('Student 4', 21, 'Grade D'), ('Student 5', 24, 'Grade E'), ('Student 5', 27, 'Grade F'), ('Student 5', 30, 'Grade G');
输出
学生姓名学生2学生 3学生 4学生 5Output
Students Name Student 2 Student 3 Student 4 Student 5提前致谢
推荐答案
select distinct Name as `Students Name` from Students where Age_Start between 15 and 27
这篇关于选择具有特定范围 sql 查询的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文