SELECT column name , column name from table name [Clause][LIMIT N] [ OFFSET M]
- You can use one or more tables in a query statement, split between tables using commas (,), and use the where statement to set the query criteria.
- The SELECT command can read one or more records.
- You can use an asterisk (*) instead of another field, and the SELECT statement returns all the field data for the table.
- You can use the WHERE statement to include any condition.
- You can use the LIMIT property to set the number of records returned.
- You can specify the data offset for the SELECT statement start query by using offset. By default, the offset is 0.
SELECT ' name ', result from ta,tb WHERE ' name ' = ' Zhang San ' LIMIT 3 OFFSET 3;
The limit is followed by 3 data, and offset is read from the 3rd bar.
select column name 1,< Span class= "PLN" > column name 2,... column name n from table 1, table 2 ... [where conditions 1 [and [or]] conditions 2 .....
/span>
- You can use one or more tables in a query statement, split between tables using commas (,) , and use the where statement to set the query criteria.
- You can specify any condition in the WHERE clause.
- You can specify one or more conditions by using and OR OR.
- The WHERE clause can also be applied to the SQL Delete or UPDATE command.
- The WHERE clause is similar to the IF condition in a program language, and reads the specified data according to the field values in the MySQL table.
SELECT ' name ', result from ta,tb WHERE ' name ' = ' Zhang San ' OR ' name ' = ' John Doe ';
The conditional operator of the WHERE clause can be = (equals sign), <>,! = (not Equal), > (greater than Sign), < (less than), >= (greater than equals), <= (less than equals).
UPDATE table Name set column Name 1= new column value 1, column Name 2= new column value 2[Clause]
- You can update one or more fields at the same time.
- You can specify any condition in the WHERE clause.
- You can update the data at the same time in a separate table.
UPDATE ta SET name= ' King II leper ' WHERE user_id= ' 1002 ';
[Clause]
- If you do not specify a WHERE clause, all records in the MySQL table will be deleted.
- You can specify any condition in the WHERE clause.
- You can delete records at once in a single table.
DELETE from Ta WHERE user_id= ' 1002 ';
select column name 1,< Span class= "PLN" > column name 2,... column name n from table name where column name 1 like condition 1 [and [or]] column name 2 = ' Column value '
- 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 equal sign =.
- Like is usually used in conjunction with%, similar to a meta-character search.
- You can specify one or more conditions by using and OR OR.
- You can use the where ... in the DELETE or UPDATE command. The LIKE clause to specify the condition.
SELECT Name,result from TA,TB WHERE ' name ' like '% ' of ' OR ' name ' like '% Li ';
MySQL Basic knowledge _2