欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

sql数据库增删查改练习题及数据库建表语句

程序员文章站 2022-03-02 21:50:13
建表语句: create table `tb_user_t2` ( `id` int(11) not null auto_increment comment '编号',...

建表语句:

create table `tb_user_t2` (
  `id` int(11) not null auto_increment comment '编号',
  `name` varchar(20) default null comment '姓名',
  `sex` varchar(4) default null comment '性别',
  `birth` year(4) default null comment '出生年份',
  `department` varchar(20) default null comment '院系',
  `phone` varchar(18) default null comment '手机号码',
  `address` varchar(255) default null comment '家庭住址',
  primary key (`id`)
) engine=innodb auto_increment=37 default charset=utf8;

1.查询所有信息:select * from tb_user_t2;

2.查询所有出生年份是2000的信息:select * from tb_user_t2 where birth = 2000;