In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "the use of select grammar in MySQL". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The basic syntax of the select statement in MySQL is:
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]]
As can be seen from this basic syntax, the simplest select statement is select select_list. In fact, using this simplest select statement, you can also accomplish many of the functions you expect. First of all, you can use it to perform any operation supported by MySQL, such as: select 1 operations 1, which will return 2. Second, you can also use it to assign values to variables, and in PHP, using this function of select statements, you are free to use MySQL functions to perform various operations for PHP programs and assign values to variables. In many cases, you will find that MySQL has many more powerful functions than PHP.
STRAIGHT_join, SQL_SMALL_RESULT, SQL_BIG_RESULT, and HIGH_PRIORITY are extensions of ANSI SQL92 to MySQL. If the optimizer joins tables in a non-optimal order, using STRAIGHT_join can 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 results will be small, requiring MySQL to use temporary tables to store the final table instead of sorting; conversely, SQL_BIG_RESULT tells the optimizer that the results will be small, requiring MySQL to use sorting instead of temporary tables.
HIGH_PRIORITY will give select higher priority than a statement that updates the table, allowing it to make a priority and fast query.
The use of the above four keywords is indeed rather obscure. Fortunately, in the vast majority of cases, we can choose not to use these four keywords in MySQL.
DISTINCT and DISTINCTROW provide a basic but useful filter for the result set returned by the query. That is, the result set contains only non-repeating rows. It should be noted here that for the keywords DISTINCT and DISTINCTROW, null values are equal, no matter how many null values there are, select only one. The use of ALL is suspected of being superfluous. It has no effect on the generation of the result set.
INTO {OUTFILE | DUMPFILE} file_name export_options, which writes the result set to a file. The file is created on the server host and cannot already exist. The syntax for the export_options part of the statement is the same as that used in the FIELDS and LINES clauses in the LOAD DATAINFILE statement.
This is the end of the introduction to "the use of select Grammar in MySQL". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.