这是建表语句!
create table student(
idcard varchar2(18),name varchar2(20),
sex int,
high int,
age int
);
create sequence idcard start with 1000 increment by 1;
insert into student values('450326198912241844','罗江超',178,null);
insert into student values('411424198912068072','候桂申',158,null);
insert into student values('450881199006112350','潘海林',177,null);
insert into student values('450111197806062156','韦山',175,null);
insert into student values('450103197912150539','廖韵',173,null);
insert into student values('450324198809231637','唐文林',null);
commit;
查询语句:
首先:查询年龄最大的人,就是身份证出生日期号码小的人。
二次查询:
select * from student where substr(idcard,7,8)=(select min(substr(idcard,8)) from student);
原文链接:https://www.f2er.com/oracle/210532.html