Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
anujrathi
Starting Member
9 Posts |
Posted - 2006-06-20 : 14:49:11
|
| Hi friends, My table Employees contain 4 Columns:1. EmpID2. EmpName3. EmpAddress &4. DeptID EmpName,EmpAddress & DeptID can contain duplicate records. In my table DeptID & EmpName has duplicates values. Then what should be the output of the following queries:1. SELECT count(1) FROM Employees;2. SELECT count(distinct 4) FROM Employees;3. SELECT count(5) FROM Employees;4. SELECT count(100) FROM Employees; In all above queries, what is 1 or 4 or 5 or 100 ? If these are column numbers then what will be the output of the 4th query.In case of query no. 1, 3 & 4, result is total no of rows present in the table. & In case of query 2, result is 1(u can place any number in place of 4).Pls give me a proper solution...I m really confusing .. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-06-20 : 14:59:48
|
| Those numbers are not the column numbers. 1,3,4 will return the number of rows in your table. 2 will return 1 as you are asking for the distinct results of value 4 (constant 4 and not associated with any data).Tara Kizeraka tduggan |
 |
|
|
|
|
|