What is the correct order of these clauses while writing a SQL query?

前端 未结 3 1207
野性不改
野性不改 2020-12-15 19:18

There are many clauses in SQL Server such as SELECT, WHERE, GROUP BY, ORDER BY, HAVING

What is the c

相关标签:
3条回答
  • 2020-12-15 19:32
    SELECT
    Groupby
    Having
    OrderBy
    

    Or

    SELECT
    WHERE
    OrderBy
    
    0 讨论(0)
  • 2020-12-15 19:50

    This is just a very generic query. You will need to start reading basics of SQL first. Check the link below first -

    http://www.sql-tutorial.net/

    0 讨论(0)
  • 2020-12-15 19:51

    http://msdn.microsoft.com/en-us/library/ms189499.aspx

    [ WITH <common_table_expression>]
    
    SELECT select_list [ INTO new_table ]
    
    [ FROM table_source ] [ WHERE search_condition ]
    
    [ GROUP BY group_by_expression ]
    
    [ HAVING search_condition ]
    
    [ ORDER BY order_expression [ ASC | DESC ] ]
    
    0 讨论(0)
提交回复
热议问题