Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Filter Out Duplications in the Returning Rows
How To Filter Out Duplications in the Returning Rows? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements
✍: FYIcenter.com
If there are duplications in the returning rows, and you want to remove the duplications, you can use the keyword DISTINCT or UNIQUE in the SELECT clause. The tutorial exercise below shows you that DISTINCT works on selected columns only:
SQL> CREATE TABLE fyi_team AS SELECT first_name, last_name FROM employees WHERE first_name = 'John'; Table created. SQL> INSERT INTO fyi_team VALUES ('John', 'Chen'); SQL> INSERT INTO fyi_team VALUES ('James', 'Chen'); SQL> INSERT INTO fyi_team VALUES ('Peter', 'Chen'); SQL> INSERT INTO fyi_team VALUES ('John', 'Chen'); SQL> SELECT * FROM fyi_team; FIRST_NAME LAST_NAME -------------------- ------------------------- John Chen John Russell John Seo John Chen James Chen Peter Chen John Chen SQL> SELECT DISTINCT * FROM fyi_team; FIRST_NAME LAST_NAME -------------------- ------------------------- Peter Chen John Chen James Chen John Seo John Russell SQL> SELECT DISTINCT last_name FROM fyi_team; LAST_NAME ------------------------- Chen Russell Seo
2007-04-20, 4757👍, 0💬
Popular Posts:
How Are Vertical Margins between Two Block Elements Collapsed? - CSS Tutorials - Understanding Multi...
How To Enter a New Row into a Table Interactively? - Oracle DBA FAQ - Introduction to Oracle SQL Dev...
Can you explain in GSC and VAF in function points? In GSC (General System Characteristic) there are ...
When should the method invokeLater() be used? This method is used to ensure that Swing components ar...
How To Run Stored Procedures in Debug Mode? - Oracle DBA FAQ - Introduction to Oracle SQL Developer ...