Write a SQL query to fetch student names containing 'nee'.

SQL
Easy
TCS
91.7K views

A practical SQL task requiring the use of pattern matching operators to filter data based on string substrings.

Why Interviewers Ask This

Database querying is a fundamental skill for data roles. This tests basic syntax knowledge, specifically the LIKE operator and wildcard usage for string matching.

How to Answer This Question

State the SELECT statement clearly. Use the WHERE clause with the LIKE operator. Apply wildcards (%) before and after the substring 'nee' to match any characters surrounding it. Ensure case sensitivity is addressed if required by the specific SQL dialect.

Key Points to Cover

  • SELECT statement
  • LIKE operator usage
  • Wildcard placement
  • Substring matching

Sample Answer

To fetch student names containing 'nee', the query would be: SELECT name FROM students WHERE name LIKE '%nee%'; This uses the percent sign as a wildcard to match any sequence of characters before or after 'nee'. If case…

Common Mistakes to Avoid

  • Using = instead of LIKE
  • Incorrect wildcard placement
  • Ignoring case sensitivity

Sound confident on this question in 5 minutes

Answer once and get a 30-second AI critique of your structure, content, and delivery. First attempt is free — no signup needed.

Try it free

Related Interview Questions

Browse all 69 SQL questionsBrowse all 128 TCS questions