Speaking of fewer keyboard strokes, there is one more thing which may come in handy and make you write less: aliases for tables.
Imagine the following situation: we want to select many columns from two joined tables. You could, of course, write it like this:
ON person.id = car.owner_id;
Takes a lot of writing, doesn't it? All those column names together with their table names... Fortunately, there is a way to make things simpler: we can introduce new temporary names (called aliases) for our tables:
FROM person AS p
JOIN car AS c
ON p.id = c.owner_id;
As you can see, after the table names in the
FROM clause we used the keyword
AS. It indicates that whatever comes next will become the new, temporary name (alias) for the table. Thanks to it, we could save our fingers a little bit and write shorter names for our tables.