This post contain the very basic question of SQL, today onward i will write multiple post with interview questions. So that it will be help you guys the question i am going to post really crispy and tricky. If you would like to share the any interview question with me, comment on any post . I will definitely
share it on my blog.
1. Difference Between Group by Clause and Having Clause
2. Different type of Clause in SQL Query
3. I have below table and some sample data in it, create a query to show the department name and total number employees working in department.
ID | DepartmentName | NumberOfEmployees |
1 | Dept A | 140 |
2 | Dept A | 100 |
3 | Dept B | 300 |
4 | Dept B | 400 |
5 | Dept C | 400 |
6 | Dept C | 700 |
Once you will be able to find the Department Name and Its total number of employees, then write query to populate the records for condition, "Whose number of employee count more than 700"
4. What is left join how it will work, write query of left join and what will be output, for below sample tables/data. (Below table are refer using TabA.CountryID = TabB.ID
Tab-A
ID | Name | CountryID |
1 | A | 21 |
2 | B | 31 |
3 | C | 31 |
4 | D | 11 |
5 | E | 11 |
6 | F | 31 |
Tab-B
ID | CountryName |
11 | India |
21 | United Status |
31 | Singapore |
2- question - Find the total number of employee living in each country, Write down the syntax and query output.