Home  >  Article  >  Database  >  What are the keywords of query commands in sql?

What are the keywords of query commands in sql?

不言
不言Original
2019-03-12 15:13:5513221browse

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 ]
select column1,column2....from [where]

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!

Statement:
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