mysql查询同年出生的人_用SQL查询年龄在18至22岁之间的学生信息(只知道出生日期) mysql中根据输入的年...

先做一个减法,,今天的时间-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 表名 如有疑问,请追问.

  • 6
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值