在数据库中怎么编写查询年龄在20——30岁之间的会员的sql语句

在数据库中怎么编写查询年龄在20——30岁之间的会员的sql语句,如果在网页上查询年龄在20——30岁之间的会员呢,怎么编写 elect * from 学生信息 where age between 18 and 20这一句sql是什么意思
2026-12-04 11:27:44
推荐回答(5个)
回答1:

select *
from 会员
where 年龄>=20 and 年龄<=30

 “elect * from 学生信息 where age between 18 and 20”此句sql最前面少个s

应该是 select * from 学生信息 where age between 18 and 20 意思是 

在学生信息中找年龄在18到20的学生所有字段信息。

回答2:

SQL数据库查询语句:
(1)在20岁以下
select * from 表 where datediff(year,出生日期,getdate())<20
(2)20-30岁
select * from 表 where datediff(year,出生日期,getdate()) between 20 adn 30
(3)30岁以的SQL误句
select * from 表 where datediff(year,出生日期,getdate())>30

回答3:

select * from table(表名) where age(年龄)>19 and age<30
查询table表年龄在19-30之间的信息
还有一种是 select * from table(表名) where age betwwen 20 and 30;
查询table表年龄在29-30之间的信息
这个2个是查询某个范围之间的
通常情况下查询范围内的用这两个
如果是任意一个 就用or

回答4:

select * from 学生信息

此句的意思是 查找 学生信息 from后面是跟着你要查找的表名

where age between 18 and 20
意思是 where --哪里 就是查找哪个咧 你的就是 age列
between 之间的意思 后面跟着 and

整句话的意思就是 查找 学生信息 表中 age列里面 18和20之间

回答5:

你需要的SQL 语句:select × from table where age between 20 and 30
select * from 学生信息 where age between 18 and 20是指返回年龄在18到20岁之间的学生信息。