Database Interview Series 4
This is Database Interview Series 4 that was asked in on Java Developer and Sr. Java Developer position in different technology company:
1. How do you debug SQL query?
2. What is your experience with SQL?
3. How good are you with SQL and what version of DB did you use recently?
4. What is index in RDBMS?
5. What is primary key?
6. What is unique key?
7. What is the difference between primary key and unique key?
8. What are Joins in SQL?
9. Can you explain Left Outer Join in SQL?
10. What is SQL injection?
11. What is an index with respect to database?
12. Why should we use indexing on database?
13. When will be indexing have inferior performance?
14. I have a customer table with name, id, state and salary. How can you find sum of all the salaries of all the customers per state?
select sum(salary), name, id from table_name group by state order by state
15. How can you find sum of all the salaries of all the customers per state where each of the individual salary is greater than 30K?
select sum(salary), name, id from table_name group by state having salary > 30000 order by state
16. What is the difference between “having” and “where” in a SQL statement?
17. Let’s say you have table called people with two columns “name” and “age” write query that display list of ages for all of the people named Tom sorted from oldest to youngest order?
select name, age from people where name = ‘Tom’ order by desc
18. Define difference between an inner and outer join?