About the analysis of SQL SELECT DISTINCT statement

jacklove
Release: 2023-03-25 15:12:01
Original
1846 people have browsed it

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
Copy after login

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
Copy after login

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!

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!