Basic database statement(4)

between…and…wait in set, &&,||etc! Etc.)
1. For example, query the age greater than twenty years old (default student table): select *from student where age >20;
Note: Only one "=" is used for the equal condition, and two ways of writing not equal to the condition: "!=, <>"
Two, query age is greater than or equal to 20 and less than or equal to 30
select *from student where age>=20 and age<=30 (more troublesome)
select *from student where age between 20 and 30; (recommended)
three, query 22 years old , 19, 25-year-old information
select *from student where age=22 or age=19 or age=25 (more troublesome)
select *from student where in ( 22 , 19, 25 ) (more convenient) to
query a certain kind of data as Empty
select *from student where x=null; (wrong writing, null cannot be used = or! = judgment)
select *from student where x is null; query is not null (is not null)

Guess you like

Origin blog.csdn.net/m0_46217913/article/details/104063528