Why SQL Strings Need Quotes
Text columns store words and codes. Literal text values must be wrapped in quotes.
String columns hold text: names, cities, states, emails, statuses, and other labels. When you compare a column to a text value, put the value in single quotes.
Without quotes, SQL thinks the value is a column name or keyword. That is
why
state = PA
is different from
state = 'PA'.
select text_column, another_column
from table_name
where text_column = 'exact text value'
order by text_column Schema · Garden Shop Table · suppliers 4 columns · 6 rows
One row per supplier. Some suppliers have no contact email.
Fix the query so it returns the supplier name and state for suppliers in PA, sorted by supplier name.
Run your query to inspect the result.
Expected answer
- Columns: supplier_name, state.
- Rows: 2 Pennsylvania suppliers.
- The suppliers should be Ironwood Tools and RootWorks Supply.
Related
Date parts, math, and truncation.
Length, case, trimming, slicing, and concatenation.
IS NULL, COALESCE, NULLIF, and null-safe logic.
See why text, numbers, dates, and booleans behave differently.
Compare, sort, and calculate with numeric values.
Compare and sort date values chronologically.