Database Management System · Class 12 · CBSE · Science Computer Science
A relation named Employee has the attributes EmpID, EmpName, Department and Salary. Which SQL query displays the names of employees who belong to the…
Practice question from Database Management System (Class 12 · CBSE · Science Computer Science), with the correct answer and a step-by-step solution.
medium · MCQ · Q-BE5DF8
A relation named Employee has the attributes EmpID, EmpName, Department and Salary. Which SQL query displays the names of employees who belong to the IT department, earn more than 50000, and whose names are arranged in ascending alphabetical order?
- A.SELECT EmpName FROM Employee WHERE Department = 'IT' AND Salary > 50000 ORDER BY EmpName ASC;Correct answer
- B.SELECT EmpName FROM Employee WHERE Department = 'IT' OR Salary > 50000 ORDER BY EmpName ASC;
- C.SELECT EmpName FROM Employee WHERE Department = 'IT' AND Salary < 50000 ORDER BY EmpName DESC;
- D.SELECT EmpName FROM Employee ORDER BY Department = 'IT' AND Salary > 50000;
Solution
The WHERE clause must require both conditions using AND, and Salary must be greater than 50000. ORDER BY EmpName ASC arranges the selected names alphabetically.
More from Database Management System
- Whatever whatever we do do do ???
- Test
- A relation named STUDENT has attributes RollNo, Name, Class and Email. RollNo is unique and never contains a NULL value, while the other at…
- Explain why storing several phone numbers as a single comma-separated value in one attribute violates First Normal Form (1NF). Suggest a su…
Practise more Computer Science
Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.
Start practising freeFree to start · No credit card needed