First, the basic usage of the WHERE clause
WHERE clause used to filter data, to extract records satisfy the conditions.
Basic usage of WHERE clause:
The SELECT * from table WHERE conditional statement;
Two, WHERE clause and excision investigation
Student demo table:
Delete student_number = 20190207 Data:
DELETE FROM student WHERE student_number = 20190207;
operation result:
Modify student_number = 20,190,206 test data name:
UPDATE student SET name = '测试' WHERE student_number = 20190206;
operation result:
Find student table, class_id = 3 of all data:
SELECT * from student WHERE class_id = 3;
operation result:
Three, WHERE clause operator
=: Equal
>: Greater than
> =: Greater than or equal
<: Less than
<=: Less than or equal
<!> Or =: is not equal to
IN: comprising the specified value
BETWEEN ... AND ...: within the specified range
LIKE: search for a pattern
IN operator uses examples:
SELECT * from student WHERE class_id IN(3,1);
operation result:
BETWEEN .. AND ... use examples:
SELECT * from student WHERE class_id BETWEEN 1 AND 3;
operation result:
LIKE operator usage example:
SELECT * from student WHERE name LIKE '小%';
operation result: