Interview Question

What are wildcards in SQL?

In LIKE patterns, percent matches many characters and underscore matches one.

💡 Concept ✅ Quick Revision 🗃️ SQL

Answer

LIKE patterns use wildcard characters to match variable text. • Percent represents zero or more characters. • Underscore represents one character. • An escape mechanism is needed when a wildcard character must be matched literally.

💡 SQL Example

SELECT code FROM products WHERE code LIKE 'A_2%';

Result

AB20 AX21

⚡ Quick Revision

In LIKE patterns, percent matches many characters and underscore matches one.