关键词提取
The distinct
keyword is used with SELECT
statement to retrieve unique values from the table. Distinct
removes all the duplicate records while retrieving records from any table in the database.
与SELECT
语句一起使用distinct
关键字从表中检索唯一值。 从数据库中任何表中检索记录时, Distinct
除去所有重复记录。
DISTINCT
关键字的语法 (Syntax for DISTINCT
Keyword)
SELECT DISTINCT column-name FROM table-name;
使用DISTINCT
关键字的示例 (Example using DISTINCT
Keyword)
Consider the following Emp table. As you can see in the table below, there is employee name, along with employee salary and age.
考虑以下Emp表。 如您在下表中所见,其中有员工姓名 ,以及员工工资和年龄 。
In the table below, multiple employees have the same salary, so we will be using DISTINCT
keyword to list down distinct salary amount, that is currently being paid to the employees.
在下表中,多个雇员的工资相同,因此我们将使用DISTINCT
关键字列出当前正在支付给雇员的不同工资金额。
eid | name | age | salary |
---|---|---|---|
401 | Anu | 22 | 5000 |
402 | Shane | 29 | 8000 |
403 | Rohan | 34 | 10000 |
404 | Scott | 44 | 10000 |
405 | Tiger | 35 | 8000 |
开斋节 | 名称 | 年龄 | 薪水 |
---|---|---|---|
401 | 阿努 | 22 | 5000 |
402 | 谢恩 | 29 | 8000 |
403 | 罗汉 | 34 | 10000 |
404 | 史考特 | 44 | 10000 |
405 | 虎 | 35 | 8000 |
SELECT DISTINCT salary FROM Emp;
The above query will return only the unique salary from Emp table.
上面的查询将仅返回Emp表中的唯一薪水。
salary |
---|
5000 |
8000 |
10000 |
薪水 |
---|
5000 |
8000 |
10000 |
关键词提取