SQL Query

Question

What is the correct order of writing SQL query from given tags(select, where, group by, having, from, order by)

solved 0
Hemant Singh 55 years 1 Answer 743 views Member 0

Answer ( 1 )

  1. SELECT column_name(s)
    FROM table_name
    WHERE condition
    GROUP BY column_name(s)
    HAVING condition
    ORDER BY column_name(s);
    Explanation: ‘select, from, where’ are always first three, now ‘group by’ statement comes when we select a column as count and with that’ having ‘statement is applied over another column rather than count one that worked similar as ‘where’ clause and finally ‘order by’ is used to sort the retrieved data.

    Best answer

Leave an answer

Browse
Browse