Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
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, 4624👍, 0💬
Popular Posts:
What will be printed as the resultof the operation below: int x; int modifyvalue() { return(x+=10); ...
What are the different accessibility levels defined in .NET ? Following are the five levels of acces...
What is synchronization and why is it important? With respect to multithreading, synchronization is ...
If we have multiple AFTER Triggers on table how can we define the sequence of the triggers ? If a ta...
How To Use "IN OUT" Parameter Properly? - Oracle DBA FAQ - Creating Your Own PL/SQL Procedures and F...