Nicely done! Here's a quick recap of what we learned today:
- Each query starts with
SELECT, followed by comma‐separated column names. To retrive all columns from a table, use the asterisk (
SELECT comes the
FROM caluse which indicates the name of the table from which you want to retrive the above data.
- Optionally, you can use a
WHERE clause to filter the rows.
- You can use mathematical signs for comparison:
- You can check, whether a value is inside an interval using
- You can compare string and text patterns using
LIKE and the following two wildcards:
% for any number of characters (including zero)
_ for only one character
- To list more than one conditional expression, use the
OR operators as needed. Remember: grouping matters. If needed use parentheses to group expressions.
NULLs are a little bit more complicated. You have to use
IS NULL to check whether a value is
- All conditions can be negated with the
Now, let's put together all the information we've learned so far. Let's imagine a customer who walks in and wants to know if we have any cars that meet his needs.