Skip to content
Worked Examples · Example 9.4

Q.Display all the details of those employees of D04 department who earn more than 5000.

Uttar Pradesh UpmspTextbookSubjective· 2mImportance★★★★★
7% · 7/95 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

A WHERE clause with AND requires both conditions to hold. Filtering the chapter's own EMPLOYEE table (Table 9.8) for DeptId = 'D04' AND Salary > 5000 picks out exactly two employees: Gurpreet and Daribha.

The query

SELECT *
FROM EMPLOYEE
WHERE Salary > 5000 AND DeptId = 'D04';

DeptId is a string column, so its value is compared in quotes ('D04'). AND means a row is returned only if both Salary > 5000 and DeptId = 'D04' are true for that row.

Checking every row of Table 9.8

EmpNoEnameSalaryDeptIdD04?Salary>5000?Selected?
101Aaliya10000D02noyesno
102Kritika60000D01noyesno
103Shabbir45000D01noyesno
104Gurpreet19000D04yesyesyes
105Joseph34000D03noyesno
106Sanya48000D02noyesno
107Vergese15000D01noyesno
108Nachaobi29000D05noyesno
109Daribha42000D04yesyesyes
110Tanya50000D05noyesno

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.