SQL statement concise tutorial for linux --- DISTINCT, concise tutorial --- distinct

Source: Internet
Author: User

SQL statement concise tutorial for linux --- DISTINCT, concise tutorial --- distinct

SELECTThe command allows us to read all the data in one or more columns of a table. This will capture all the data, regardless of whether the data value is repeated or not. In data processing, we often encounter different data values in the table. In other words, we need to know the different values in the table/column, and the number of occurrences of each value is not important. How can this be achieved? In SQL, this is easy to do. We only needSELECTAddDISTINCTYou can.DISTINCTSyntax:

Select distinct "column name"
FROM "table name ";

For example, in the following table,Store_InformationWhen you find all different store names,

Store_InformationTable

Store_Name Sales Txn_Date
Los Angeles 1500 05-Jan 1999
San Diego 250 07-Jan-1999
Los Angeles 300 08-Jan 1999
Boston 700 08-Jan 1999

Let's get,

Select distinct Store_Name FROM Store_Information;

Result:

Store_Name
Los Angeles
San Diego
Boston

Test results in linux:


Reprinted, please note: Xiao Liu

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.