1.WHERE 子句条件操作符 包括:> .<.>=.<=.!= .=.BETWEEN ... AND ...(在指定的两个值之间) 示例: 1)select * from student where stu_id=267; 2)select * from student where stu_id<267; 3)select * from student where stu_id between 267 and 305; 空值检查:使用 NULL 关键字 select * f
数据准备: 创建表: create table students( id int unsigned primary key auto_increment not null, name varchar(20) default '', age tinyint unsigned default 0, height decimal(5,2), gender enum('男','女','人妖','保密'), cls_id int unsigned default 0, isdelete bit defau
我们知道在SqlServer中可以用Select语句给变量赋值,比如如下语句就为int类型的变量@id赋值 ; select @id=id from ( as id union all as id union all as id ) as t select @id 执行上面的代码会显示下面的查询结果,结果显示最后@id的值为3,那么意味着上面第3行的select语句每返回一行数据记录,sqlserver就用id列为@id进行了一次赋值,而最后一行数据记录id列为3,所以在第12行的查询中最后查得