Skip to content
Question 37 of 40

Q.‘Employee’ table has a column named ‘CITY’ that stores city in which each employee resides. Write SQL query to display details of all rows except those rows that have CITY as ‘DELHI’ or ‘MUMBAI’ or ‘CHANDIGARH’.

Puducherry TnboardCBSE Class XII Board 2019Subjective· 1mImportance★★★★★
93% · 37/40 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 →

To exclude rows where CITY is DELHI, MUMBAI, or CHANDIGARH, use the NOT IN operator with a list of those city names in the WHERE clause.

When you need to filter out specific values from a column, SQL gives you a clean and readable way to do it. The NOT IN operator is exactly what you need here — it lets you specify a list of values to exclude, and the database returns every row where the column does not match any value in that list.

Think of it this way: you want all employees except those living in three particular cities. Instead of writing multiple AND conditions with != (which would be messy and error-prone), you simply write CITY NOT IN ('DELHI', 'MUMBAI', 'CHANDIGARH'). The database checks each row: if the CITY value is any of those three, the row is skipped; otherwise, it is included.

Note

The NOT IN operator works with any data type — numbers, dates, or text. Just ensure the values in the list match the column's data type exactly (here, text strings in single quotes).

The full query would look like this:

SELECT * FROM Employee
WHERE CITY NOT IN ('DELHI', 'MUMBAI', 'CHANDIGARH');

This returns all columns (*) for every employee whose city is not Delhi, Mumbai, or Chandigarh. If you only need specific columns (like name, salary, or department), replace * with those column names. …

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.