MySQL基础知识

/**

*1.进入自己的数据库,创建一张student表(字段有:学号(sid),姓名(sname),

年龄(sage),身高(sheight))

*其中,sid为定长类型,最大长度为30,并且有主键约束;sname为变长类型,

最大长度为40,且有非空约束;

*age为int类型,没有任何约束条件。

*shight为浮点类型,并且不能为空。

**/

/*

*2.往student表里面添加数据

**/

insert into class_03.student values("2011770301","文立飞",19,1.70);

insert into class_03.student values("2011770301","马云",20,1.72);

insert into class_03.student values("2011770302","文欢",20,1.72);

insert into class_03.student values("2011770302","文武双全",20,1.74);

insert into student values("2011770303","欧文露",21,1.69);

insert into student values("2011770304","李云飞",23,1.75);

insert into student values("2011770305","李世民",18,1.75);

insert into student values("2011770306","李四",24,1.80);

insert into student values("2011770306","李世成",23);

insert into student values("2011770307","张飞",25,1.81);

insert into student values("2011770308","令狐小飞",27,1.82);

insert into student values("2011770309","小李飞刀",22,1.83);

insert into student values("2011770310","唐太宗",30,1.86);

insert into student values("2011770311","李",21,1.91);

insert into student values("2011770312","飞",22,1.65);

insert into student values("2011770313","飞",22,1.66);

insert into student values("20117703014","唐飞",22,1.65);

insert into student values("2011770320","王五",NULL,1.92);

insert into student values("2011770321","王云",NULL,1.74);

insert into student values("2011770322","李渊",NULL,1.74);

insert into student values("2011770323","李飞菲",NULL,1.73);

insert into student values("2011770323","李菲菲",NULL,1.84);

insert into student values("2011770323","李小菲",NULL,1.68);

insert into student values("2011770324","王某某",NULL,1.85);

 

 

 

需求(练习)

1.查询学生年龄在23岁-27岁之间的学生信息。

 

2.查询学生姓名带飞字的信息。

 

3.查询学生年龄为null的学生信息。

 

4.查询学生年龄为非空的学生信息。

 

5.查询学生年龄大于22岁的学生信息。

 

6.查询学生年龄小于21岁的学生信息。

7.查询姓王的学生信息。

 

8.查询以菲字结尾的学生信息。

 

 

9.把学生姓名为李渊的年龄修改为19岁。

10.删除学生姓名为王云的学生记录。

 

 

11.删除学生姓名为王五


12.删除学生年龄大约等于29岁,并且身高超过1米8(不包括1米8)的学生信息。

 



13.查询学生年龄为:18,19,23岁的信息。

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值