select distinct(empid),distinct(dept),name
from EMP


will the above query work?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is db2 plan table?

818


What do you mean by between and in? Is between inclusive of specified range values?

877


How can tablespace be moved to another dasd volume that is allocated for that tablespace?

984


Define check constraint.

850


What is db2 and what is the use of db2 optimizer?

841


What is the maximum size of a char data type in db2?

777


have 3 tables table1, table2 and table3 which contains employee information. table1 is master table, table2 contains emp details like emp no and so on, table 3 contains emp salary. so if any emp leave company between 25th - 30th of every month it has to get updated in tables. but it is not getting updated. What is the reason.

1499


What is sqlca?

821


What is the maximum size of varchar data type in db2?

866


Which command is used to connect to a database in DB2 ? Give the Syntax.

844


What kind of database is db2?

788


Explain in detail about buffer manager and its functionalities?

790


what is db2 restart?

1911


What is ibm db2 used for?

835


Explain about rct in db2?

873