DecodeAI
← Question Bank

SQL & Computer Science

SQL Questions

Interview questions on SQL Questions.

47 questions

SQL Questions

Q1. How do you retrieve the first name from the Worker table using an alias "WORKER NAME"?

Sign in to bookmark

SQL Questions

Q2. How can you convert the first name from the Worker table to uppercase?

Sign in to bookmark

SQL Questions

Q3. What SQL query would you use to fetch distinct department names from the Worker table?

Sign in to bookmark

SQL Questions

Q4. How can you select the first three characters of the first name from the Worker table?

Sign in to bookmark

SQL Questions

Q5. Write a query to find the position of 's' in the first name "Manish" within the Worker table.

Sign in to bookmark

SQL Questions

Q6. How do you trim whitespace from the right side of the first name in the Worker table?

Sign in to bookmark

SQL Questions

Q7. Write a query to remove whitespace from the left side of the department field in the Worker table.

Sign in to bookmark

SQL Questions

Q8. How can you fetch unique department names from the Worker table and display their lengths?

Sign in to bookmark

SQL Questions

Q9. What query would replace 'a' with 'A' in the first name from the Worker table?

Sign in to bookmark

SQL Questions

Q10. How do you concatenate the first name and last name from the Worker table into a single column "COMPLETE NAME"?

Sign in to bookmark

SQL Questions

Q11. Write a query to list all worker details from the Worker table ordered by first name in ascending order.

Sign in to bookmark

SQL Questions

Q12. How can you list all worker details from the Worker table ordered by first name ascending and department descending?

Sign in to bookmark

SQL Questions

Q13. Write a query to fetch details for Workers with the first names "

Sign in to bookmark

Manish" and "Arhan" from the Worker table.

SQL Questions

Q14. Write a query to list details of workers excluding first names "Manish" and "Arhan" from the Worker table.

Sign in to bookmark

SQL Questions

Q15. Write a query to fetch details of Workers with the department name "Admin".

Sign in to bookmark

SQL Questions

Q16. Write a query to fetch details of Workers whose first name contains 'a'.

Sign in to bookmark

SQL Questions

Q17. Write a query to fetch details of Workers whose first name ends with 'a'.

Sign in to bookmark

SQL Questions

Q18. Write a query to fetch details of Workers whose first name ends with 'h' and contains six alphabets.

Sign in to bookmark

SQL Questions

Q19. Write a query to fetch details of Workers whose salary lies between 100000 and 500000.

Sign in to bookmark

SQL Questions

Q20. Write a query to list Workers who joined in February 2014.

Sign in to bookmark

SQL Questions

Q21. Write a query to fetch the count of employees working in the department 'Admin'.

Sign in to bookmark

SQL Questions

Q22. Write a query to fetch worker names with salaries between 50000 and 100000.

Sign in to bookmark

SQL Questions

Q23. Write a query to fetch the number of workers for each department in descending order.

Sign in to bookmark

SQL Questions

Q24. Write a query to list details of Workers who are also Managers, assuming a title table contains info about worker titles.

Sign in to bookmark

SQL Questions

Q25. Write a query to count the number of titles in the organization of different types.

Sign in to bookmark

SQL Questions

Q26. Write a query to show only odd rows from the Worker table.

Sign in to bookmark

SQL Questions

Q27. Write a query to show only even rows from the Worker table.

Sign in to bookmark

SQL Questions

Q28. Write a query to clone a new table from another table (e.g., worker_clone from worker).

Sign in to bookmark

SQL Questions

Q29. Write a query to fetch intersecting records of two tables (worker and worker_clone).

Sign in to bookmark

SQL Questions

Q30. Write a query to show records from one table that another table does not have.

Sign in to bookmark

SQL Questions

Q31. Write a query to show the current date and time.

Sign in to bookmark

SQL Questions

Q32. Write a query to show the topn (e.g., 5) records of a table ordered by descending salary.

Sign in to bookmark

SQL Questions

Q33. Write a query to determine the nth (e.g., 5th) highest salary from a table.

Sign in to bookmark

SQL Questions

Q34. Write a query to find the 5th highest salary without using the LIMIT keyword.

Sign in to bookmark

SQL Questions

Q35. Write a query to list employees with the same salary.

Sign in to bookmark

SQL Questions

Q36. Write a query to show the second highest salary from a table using a sub-query.

Sign in to bookmark

SQL Questions

Q37. Write a query to show one row twice in results from a table.

Sign in to bookmark

SQL Questions

Q38. Write a query to list worker ids who do not receive a bonus.

Sign in to bookmark

SQL Questions

Q39. Write a query to fetch the first 50% records from a table.

Sign in to bookmark

SQL Questions

Q40. Write a query to fetch the departments that have less than 4 people in them.

Sign in to bookmark

SQL Questions

Q41. Write a query to show all departments along with the number of people in there.

Sign in to bookmark

SQL Questions

Q42. Write a query to show the last record from a table.

Sign in to bookmark

SQL Questions

Q43. Write a query to fetch the first row of a table.

Sign in to bookmark

SQL Questions

Q44. Write a query to fetch the last five records from a table.

Sign in to bookmark

SQL Questions

Q45. Write a query to print the names of employees having the highest salary in each department.

Sign in to bookmark

SQL Questions

Q46. Write a query to fetch three max salaries from a table using a co-related subquery.

Sign in to bookmark

SQL Questions

Q47. Write the order of executions of SQL operations.

Sign in to bookmark