Home > Database > Mysql Tutorial > body text

What are the keywords of query commands in sql?

不言
Release: 2019-03-12 15:13:55
Original
13234 people have browsed it

This article will summarize the keywords used in query statements. Let’s look at the specific content below.

What are the keywords of query commands in sql?

The simplest query:

select * from [where ]
Copy after login
select column1,column2....from [where]
Copy after login

What needs to be noted here is the keywords used in conditional filtering in the where clause, For example, '%' (match one or more characters) and '_' (match only one) in the logical operator like are used.

distinct keyword

This keyword is mainly used to retrieve the unique value in the column.

Use aliases

Using aliases can display the name we want for easy reading. For example: select city as city from

group by and having clause

group by are used to group the query result set and must be located in the select statement After the from clause or where clause.

The having clause is similar to the where clause, immediately following the group by clause, as a query condition.

Note: The where clause acts on the query conditions in a record, while the having clause acts on the query conditions on a column

inner join

Requires that multiple tables queried must have the same matching items.

The query results to be executed must contain records with the same category number in both tables before they can be queried.

left join

Left outer join: When joining, all items in the table on the left side of the on condition are queried, and if there is no matching item in the right table, then Replace with null.

right join

The right outer join result is the opposite of the left join. All items in the right table are queried, and those with no matching items in the left table are replaced by null.

full join

Returns the result regardless of all items on the left or right. If there is no corresponding item, it will be replaced by null.

The above is the detailed content of What are the keywords of query commands in sql?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
sql
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template