Commonly used DML statements

Select query The
following is the general select syntax for querying data in the mysql database.
Select column_name,column_name
From table_name
(where Clause)
(Limit n,n(

You can use one or more tables in the query statement, separate the tables with commas, and use the where statement to set the query conditions. The
Select command can read one or more records.
You can use fortunately (*) instead of other fields. The select statement will return all the field data of the table.
You can use the where statement to include any conditions.
You can use the limit attribute to set the number of records returned. You can use
offset to specify the data offset at which the select statement starts to query. The offset is by default Is 0

Insert picture description here

Where clause
We know that the SQL select statement is used to read data from the mysql table.
If you need to conditionally select data from the table, you can use the where clause to read the data from the data table.

1. One or more tables can be used in the query statement, separated by commas, and the where statement is used to set the query conditions
2. Any condition
can be specified in the where clause, 3. It can be specified by using and or or One or more conditions
4. Where clauses can also be used in SQL delete or update
5. Where clauses are similar to if conditions in programming languages, according to the field values ​​in the table to read the specified data The
following is a list of operators, available In the where clause

Set A=10 B=20

Operator overview

If we read the specified data in the mysql data table now, the where clause is very useful.
Using the primary key as the conditional query of the where clause is very fast.
If the given condition does not have any matching records in the table, then The query will not return any data

Link clause:
We know that the SQL select command is used in mysql to read data, and we can use the where clause in the select statement to get the specified record

You can use the equal sign in the Where clause to get all the records where the runoob_author field contains the "COM" character. This is why we need to use the SQL link clause in the where
clause. Use the percent sign (%) character in the SQL like clause. Represents any character, similar to the asterisk in Unix or regular expressions *
If the percent sign (%) is not used, the like clause is the same as the equal sign =. The
following is the SQL select statement using the like clause from the data table General syntax for reading data in

Select field1,field2……fieldN
FROM table_name
WHERE field1 LIKE condition1 [AND [or]] field2='comevalue'

Insert picture description here

You can specify any condition
in the where clause. You can use the like clause in the where clause.
You can use the like clause instead of the equal sign. =
Like is usually used with %. A search similar to a metacharacter
can be specified with and or or. One or more conditions
can use where in the delete or update command. . like clause to specify conditions