The following articles mainly describe how to quickly master the actual operation steps of MySQL SELECT statements, and what precautions should we pay attention to when learning MySQL SELECT statements? The following describes the main content of the article.
How to install and operate a MySQL database (the best combination with PHP)
How to back up and restore a MySQL database (the best combination with PHP)
VC Implementation and Application of MySQL (best combination with PHP) database interface (2)
How to back up a MySQL database (the best combination with PHP)
MySQL (the best combination with PHP): use Java to test the best combination of MySQL (and PHP) Databases
MySQL (best combination with PHP) database technology 01)
How to connect to MySQL (the best combination with PHP) database in ASP
The easiest way to back up a MySQL database (the best combination with PHP)
MySQL (best combination with PHP) database backup and recovery
MySQL (the best combination with PHP) has too many database connections.
This article provides a quick and detailed understanding of MySQL SELECT statements in MySQL (the best combination with PHP) databases.
The basic syntax of the SELECT statement in MySQL (the best combination with PHP) is:
The following is a reference clip:
- SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT]
- [SQL_BIG_RESULT] [HIGH_PRIORITY]
- [DISTINCT|DISTINCTROW|ALL]
- select_list
- [INTO {OUTFILE|DUMPFILE} 'file_name' export_options]
- [FROM table_references [WHERE where_definition]
- [GROUP BY col_name,...] [HAVING where_definition]
- [ORDER BY {unsighed_integer|col_name|formura} [ASC|DESC],...]
- [LIMIT [offset,] rows] [PROCEDURE procedure_name]]
From this basic syntax, we can see that the simplest MySQL SELECT statement is SELECT select_list. In fact, you can use this simplest SELECT statement to complete many functions you want, first, you can use it to perform any operation supported by MySQL (the best combination with PHP). For example: SELECT 1 + 1, it returns 2. Second, you can also use it to assign values to variables. in PHP, using the SELECT statement function, you can freely use MySQL (the best combination with PHP) and assign values to variables. In many cases, you will find that MySQL (the best combination with PHP) has many more powerful functions than PHP.
STRAIGHT_JOIN, SQL _SMALL_RESULT, SQL _BIG_RESULT, and HIGH_PRIORITY are extensions of ANSI SQL92 in MySQL (the best combination with PHP. If the optimizer joins tables in a non-optimal order, use STRAIGHT_JOIN to speed up the query.
SQL _SMALL_RESULT and SQL _BIG_RESULT are a set of relative keywords. They must be used with group by, DISTINCT, or DISTINCTROW. SQL _SMALL_RESULT tells the optimizer that the result will be very small. MySQL (the best combination with PHP) is required to use a temporary table to store the final table instead of using the sorting. Otherwise, SQL _BIG_RESULT tells the optimizer that the result will be very small, mySQL (the best combination with PHP) is required to use sorting instead of temporary tables.
HIGH_PRIORITY will give MySQL SELECT a higher priority than a statement for updating a table, so that it can perform a quick query with priority.
The usage of the above four keywords is indeed obscure. Fortunately, in most cases, we can choose not to use these four keywords in MySQL (the best combination with PHP.
DISTINCT and DISTINCTROW provide a basic but useful filter for the returned result set. That is, only non-duplicate rows are included in the result set. Note that for keywords DISTINCT and DISTINCTROW, NULL values are equal, no matter how many NULL values there are, select only one. The use of "ALL" is too confusing. It has no effect on the generation of result sets.
INTO {OUTFILE | DUMPFILE} 'file _ name' export_options to write the result set to a file. Files are created on the server host and cannot exist. The syntax in the export_options section of the statement is the same as that in the FIELDS and LINES clauses used in the load datainfile statement. We will use MySQL (the best combination with PHP) in the advanced _ load data section, we will discuss it in detail. The keyword difference between OUTFILE and DUMPFILE is that only one row is written to the file before, and no column or row ends.
The above content is an introduction to the quick understanding of the MySQL SELECT statement.