先做一个减法,,今天的时间-18年和22年,得到的2个日期TEMP1 ,TEMP2 然后SELECT * FROM [TABLE] WHERE DATETIME> TEMP1 AND DATETIME
-- Oracle
SELECT *
FROM 表
WHERE
MONTHS_BETWEEN ( sysdate, 出生日期 ) > 30 * 12;
-- SQL Server
SELECT *
FROM 表
WHERE
DATEDIFF(yy, 出生日期, GETDATE()) > 30
String sql = "SELECT * FROM teacher where to_char(sysdate,'yyyy')-to_char(birthday,'yyyy') = " +key+"
";
select * from 表名 where 年龄字段名>=15 and 年龄字段名<=22
select * from student where age < 22 and sex = '女'
用SQL查询年龄在18至22岁之间的学生信息(只知道出生日期)_
: select *from表名 where age between18 and 22 group by age
SQL数据库找出年龄在18岁以下的所有员工_
: select * from 员工表where 年龄<18...
用户表里有出生日期,用sql语句查询年龄大于18
: select 字段姓名,字段出生日期 from 表 where 字段年龄>20 and 字段性别='男';
用sql语言编写 查询年龄在19至21岁或者性别为“女”的学生的学号和所在系别编号.
: select [学号], [系别编号]from studentwhere 1=1and (1=2 or [年龄] between19 and 21 or [性别] = 'F')
如何用SQL语句筛选出年龄在18到25之间且性别为'女'的所有用户记录_
: select * from tablename where 年龄 BETWEEN 10 and 20 and 性别='女'
用sql语句查询所有男生年龄20和所以女生年龄18的所有信息
: select * from student where sex='男' and age=20 or sex='女' and age=18
用SQL查询学生表年龄在20_23岁之间的学生姓名、系名、年龄_
: 1.select sname,sage from student where sage2.select sname,sage,sdept from student where sage not between 20 and 233.select sname,cname,grade from student join sc on student .sno=sc.sno join course on course.cno=sc.cno
1、求用SQL查询所有年龄在20岁以下的学生姓名与年龄.2、查询年龄不在20_23(包含20、23_
: 1.SELECT Sname,Sage FROM Student WHERE Sage2.SELECT Sname,Sage,Sdept FROM Student WHERE Sage NOT BETWEEN 20 AND 233.SELECT Sname,Cname,Grade FROM Student JOIN SC ON Student .Sno=SC.Sno JOIN Course ON Course.Cno=SC.Cno
用数据库语句查询年龄在19~21范围内的学生信息_
: select * from student left join grade on student.学号 = grade.学号 left join curriculum on grade.课程编号=curriculum.课程编号 where DateDiff(yy, 出生日学号 期, getdate() ) between 19 and 21
如何用sql语句通过身份证号查询年龄 如何用sql语句通过身份证号查询年龄_
: 你好!15位:select round(months_between(to_date(substr(sfzhm,7,12)),'yymmdd'),'080229')/12,2) from 表名18位:select round(months_between(to_date(substr(sfzhm,9,14)),'yymmdd'),'080229')/12,2) from 表名 如有疑问,请追问.