SELECT DISTINCT

A. The SELECT statement is used to select data from the database. The results are stored in a result table, called a result set.

    SELECT  column_name, column_name
       FROM  table_name;
    SELECT * FROM  table_name;
Two. SELECT DISTINCT statement is used to return only difference values. (De-emphasis)

In the table, the column may contain a plurality of duplicate values, different lists (DISTINCT) value.

DISTINCT keyword is used to return only difference values.

SELECT DISTINCT column_name,column_name
                    FROM table_name;

  • Multiple columns to reuse separated. They were applied to each column deduplication
  • distinct must be close to the select use: select name, distinct from the Table of the type; - will prompt an error
  • Fields distinct statement can only be displayed in select distinct fields specified
  • SELECT COUNT (DISTINCT TYPE) FROM SYS_DICT --DISTINCT no more columns
     
 

 

Guess you like

Origin www.cnblogs.com/hpwd/p/11237811.html
Recommended