SQL Query Practice Question
Que 1:-Write a query to find the number of employee in each department. Given table is following. Emp_id Emp_name Department 1 ishant cse 2 rahul ece 3 ankit cse 4 deepak it 5 anshul it 6 anurag ece 7 aman cce 8 rohit it 9 rajesh cse 10 Kamal ece (tbl ) Before reaching to the exact answer of the above question we will see some basic concepts . Now the question is what will happen if we write the following query select * from tbl group by department; result is:- Emp_id Emp_name Department 9 rajesh cse 10 kamal ece 8 rohit it I am sure you must be wondering why it is just giving the single row rather you have applied group by on department .So the answer is of your question is in the folling question. Suppose I have a table Tab1 with attributes - a1, a2, ... etc. None of the attributes are unique. What will be the nature of the following query? Will it return a single row al