增加一个date类型的birday字段:alter table demo add birday data;
更新表:update demo set birday="1990/02/23" ;
加上条件:update demo set birday="1990/02/23" where id="1";
update demo set birday="1995/12/14" where id="2";
select * from demo;
查询部分内容:
select * from demo limit2;
降序: select * from demo order by id desc;
升序:select * from demo order by id asc;
由高到低排序,取前面两个:select * from demo order by id desc limit 2;
根据年龄进行升序排序:select * from demo order by birday asc;
选取年龄第二大的人:select * from demo order by birday limit 1,1; 从1开始取1条
更新数据 ;updata demo set birday="1982/10/22" where id=3;
select * from demo order by birday;
查找年龄最大的两个人:select * from demo where birday <=(select birday from demo order by birday limit 1,1);
查找是哪年出生:select year(birday) from demo;
将重复的过滤掉:select distinct year(birday) from demo;