select distinct(empid),distinct(dept),name
from EMP
will the above query work?
Answers were Sorted based on User's Feedback
Answer / harsha
No, It will not work. SELECT DISTINCT works only for single
cloumn.
DISTINCT can be applied multiple times only when you want
to apply aggregate functions such as COUNT, AVG & SUM.
e.g.
SELECT COUNT(EMPNO)/COUNT(DISTINCT(WORKDEPT)), COUNT
(DISTINCT(JOB))
FROM DSN8810.EMP
Is This Answer Correct ? | 14 Yes | 1 No |
Answer / chidambara subbu
No, It will not work. We can select DISTINCT values for
multiple columns however not all the columns will give
ditint value. For intance , see below table TABLE1
Name City
XXX Chennai
FFF HYD
XXX Blore
YYY Mumbai
1.SELECT DISTINCT NAME FROM TABLE1
Name
XXX
FFF
YYY
2. SELECT DISTINCT NAME,City FROM TABLE1
Name City
XXX Chennai
FFF HYD
XXX Blore
YYY Mumbai
See the result of second query. It has selected duplicate
entry 'XXX' in the Name column.
Is This Answer Correct ? | 0 Yes | 0 No |
How do you filter out the rows retrieved from a Db2 table ?
What are sqlcodes –803,-805, -811, -818,-904,-911,-913,-101, +100?
Explain what a plan is?
How do we specify index to include or not during bind process.
What are the three lock types?
Describe major components of db2?
What does the sqlcode of -818 pertain to?
Explain the function of data manager.
What is check constraint in db2?
How to see the structure of db2 table??
What parameters are used to control the free space in DB2?
What is correlation names?