Home >Backend Development >PHP Tutorial >About the analysis of SQL SELECT DISTINCT statement

About the analysis of SQL SELECT DISTINCT statement

jacklove
jackloveOriginal
2018-05-08 09:44:521904browse

SQL SELECT DISTINCT statement plays an important role in database operations, and this article will explain it.

SQL SELECT DISTINCT statement

The table may contain duplicate values. This is not a problem, but sometimes you may want to just list distinct values.

The keyword DISTINCT is used to return uniquely different values.

Syntax:

SELECT DISTINCT column name FROM table name

Use DISTINCT keyword

If you want to select all from the "Company" column value, we need to use the SELECT statement:

SELECT Company FROM Orders

Please note that in the result set, W3School is listed twice.

To select only unique values ​​from the "Company" column, we need to use the SELECT DISTINCT statement:

SELECT DISTINCT Company FROM Orders

This article provides a relevant explanation of the SQL SELECT DISTINCT statement, more For learning materials, please pay attention to the php Chinese website to view.

Related recommendations:

Related knowledge about the SQL SELECT statement

How to use JSON

Understand the relevant syntax of json

The above is the detailed content of About the analysis of SQL SELECT DISTINCT statement. 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