English

Sonal needs to display name of teachers, who have "o" as the third character in their name. She wrote the following query. Select name From teacher Where name ="$$o?"; But the query is not producing

Advertisements
Advertisements

Question

Sonal needs to display name of teachers, who have "o" as the third character in their name. She wrote the following query.

Select name
From teacher
Where name ="$$o?";

But the query is not producing the result. Identify the problems.

Very Short Answer
Advertisements

Solution

Problems:

  • = cannot perform pattern matching; use LIKE.
  • SQL wildcards are % and _, not $$ and ?.
  • For o as the third character, use two underscores before o, followed by %.
SELECT name
FROM teacher
WHERE name LIKE '__o%';
shaalaa.com
  Is there an error in this question or solution?
Chapter 10: Structure Query Language - EXERCISE [Page 196]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 10 Structure Query Language
EXERCISE | Q 7. | Page 196
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×