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
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!