A string is text data: a group of characters such as a title, name, or payment method. In SQL filters, enclose string values in straight single quotes. Without them, a non-numeric filter value causes a syntax error. section 5.1.2
Find a title by name
SELECT Advance FROM title WHERE TitleName = 'Anne of Fact Tables'; The quoted value must exactly match the stored value. A missing character, extra space, tab, or carriage return can change the result to no rows. Use ordinary keyboard single quotes, not typographic quotes copied from a document. section 5.1.2
SELECT Advance FROM title WHERE TitleName = 'Anne of Fact Tables';
Use the complete query to see how a string value appears in a practical WHERE condition. section 5.1.2
String searches can use ranges, but wildcard patterns are clearer when the goal is to match a pattern such as surnames beginning with S. Range results can vary with collation, letter case, and accented characters. section 7.1
Strings also appear in other SQL tasks:
- Combine two or more strings by concatenating them with the CONCAT function; do not assume that the plus sign performs this job across database systems. section 15.1
- Assign a string to a MySQL user-defined variable with SET, then inspect it with SELECT. section 13.1.1
- Keep numeric values unquoted when filtering numeric columns, because implicit conversion can reduce query performance on larger data sets. section 5.4























