mardi 29 septembre 2015

What's the difference in sql for table name aliasing with and without AS? [duplicate]

This question already has an answer here:

Say I have a table states with each state's abbreviation. The following two queries give the same result:

SELECT name
FROM states s
WHERE s.abbrev='CA';


SELECT name
FROM states AS s
WHERE s.abbrev='CA';

Both give California in the output.

It seems that the query works just fine with or without AS. So my question is, what difference does the keyword AS make, and what are the cases when we must or must not use AS?

Aucun commentaire:

Enregistrer un commentaire