消除掉重复行-SQL语言基础

时间:2024-05-15 13:24:48
【文件属性】:

文件名称:消除掉重复行-SQL语言基础

文件大小:5.26MB

文件格式:PPT

更新时间:2024-05-15 13:24:48

SQL 基础

消除掉重复行 * 在SELECT语句中用 DISTINCT关键字来消除所有重复的行。 SQL> SELECT DISTINCT deptno 2 FROM emp; DEPTNO --------- 10 20 30 * Duplicate Rows (continued) To eliminate duplicate rows in the result, include the DISTINCT keyword in the SELECT clause immediately after the SELECT keyword. In the example on the slide, the EMP table actually contains fourteen rows but there are only three unique department numbers in the table. You can specify multiple columns after the DISTINCT qualifier. The DISTINCT qualifier affects all the selected columns, and the result represents a distinct combination of the columns. DEPTNO JOB ------ --------- 10 CLERK 10 MANAGER 10 PRESIDENT 20 ANALYST ... 9 rows selected. SQL> SELECT DISTINCT deptno, job 2 FROM emp;


网友评论