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, 4857👍, 0💬
Popular Posts:
Can you explain in GSC and VAF in function points? In GSC (General System Characteristic) there are ...
How To Create an Add-to-NewsGator Button on Your Website? - RSS FAQs - Adding Your Feeds to RSS News...
What does address of operator do in background? The AddressOf operator creates a delegate object to ...
How To Increment Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a...
What is AL.EXE and RESGEN.EXE? In the previous question you have seen how we can use resource files ...