MySQL search: WHERE, mysql search where
You can use the where condition to search by specifying a Search Condition in MySQL.
In a SELECT statement, data is filtered based on the conditions specified in the WHERE substatement. The WHERE substatement is given after the table name.
The product table is as follows:
A. Search for rows with a price equal to 2.50.
There are the following types of operators after the WHERE statement. With these operators, you can filter the corresponding conditions:
Operator |
Description |
= |
Equal |
<> |
Not equal |
! = |
Not equal |
< |
Less |
<= |
Less than or equal |
> |
Greater |
> = |
Greater than or equal |
BETWEEN |
Between two values |
B character search
C search for all products with prices less than 10:
D. Search value range
I want to sort and display the results after the search, but this does not seem to work. It may be that after SELECT, only one clause can be followed:
Mysql advanced Query
Stored Procedure:
Drop procedure if exists p_1;
DELIMITER $
Create procedure 'mysql'. 'P _ 1 '()
BEGIN
DECLARE num int default 0;
Select COUNT (*) INTO num from TableName where department Name = Department and Time BetWeen Time 1 and Time 2;
IF num> 0 THEN
// Exact Query
ELSE
// Fuzzy search
End if;
END $
DELIMITER;
MYSQL statement. If you want to search for a field that contains a string, how can you write it?
Select * from table where A like '% BBB %' and condition; execute the following SQL statement to check whether the returned value exists.
Update table set A = replace ('bbb ', '', A) where A like' % BBB % 'and condition;
Oh ..
In this case, we can only extract it and split it into Arrays for judgment.