学生信息,在校(status=1),院系为信息技术系(department=1),中文学系(department=2)、物理学系(department=3)、化学系(department=4),一共就这四个系。
问:查询状态正常的信息技术系和中文学系学信信息:
select * from student where status=1 and department=1 or department=2;
||
||
||
||
V
你是这样想的吗
||
||
||
||
V
||
||
||
如果你也是像我第一次这样想的 ,哈哈,我们错了,正解在下面
||
||
||
||
V
||
||
||
select * from student where status=1 and department<>3 and department<>4 ; 正确