1

So my question is, does the following have any differrences?

select count(students) as nos from tbl_student;

or

select count(students)nos from tbl_student
ekostadinov
  • 6,880
  • 3
  • 29
  • 47
Alan George
  • 13
  • 1
  • 4
  • 1
    No there are nor differences – Jens Sep 26 '14 at 06:23
  • 1
    There is no difference in both expression Please refer this http://stackoverflow.com/questions/4164653/whats-the-purpose-of-sql-keyword-as – VidyaR Sep 26 '14 at 06:30
  • 1
    AS is optional. But the difference between two queries is ... you don't even have a white space in your seconds query before nos. That will give you an error :-p – Riz Sep 26 '14 at 06:31
  • @riz you're mistaken. These queries are identical, as EXPLAIN EXTENDED would demonstrate. – Strawberry Sep 26 '14 at 06:43

1 Answers1

1

There is no difference. 'AS' keyword is optional.

People find it more readable and clear while you use AS keyword. The reason for using it is that when reading a large query, it is easier to pick out the aliases by looking for the AS's.

Follow this SO QUESTION1... SO QUESTION2... SO QUESTION3

Community
  • 1
  • 1
Rumin
  • 3,787
  • 3
  • 27
  • 30