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