找回密码
 立即注册

推荐阅读

  • 便民服务
  • 关注我们
  • 社区新手
1.约束
primary key :主键约束,确保数据的唯一性,且值不能空
foreign key:外键约束,确保数据的完整性
not null:非空约束,当一行其他字段有数据时,该字段必须得写入数据
default:默认值约束,如果有自定义他为主没有就使用默认
auto_increment:自增长约束,作用在主键上面,以1为单位增加
and 和 or:满足多条件情况
and:且,表示同时满足多个条件
select id from stu where sex=1 and name='张三'
or: 或,表示满足其一即可
select name from student where age=40 or age=30

between and:一个整数取值范围
select * from stu where age between 23 and 30
查询年龄为23到30的所有人信息

in:它限制的是一个集合,只要字段的值在集合中就符合条件,not in 不在集合中
select * from stu where age in (23,26,31,47)==》在集合中就符合查找条件
select * from stu where age not in (23,26,31,47)==》不在集合中就符合查找条件


分享至 : QQ空间
收藏

0 个回复

您需要登录后才可以回帖 登录 | 立即注册