Clauses with SELECT Query in SQL?

  • Hello Everyone, Can anyone explain to me what are some common clauses used with SELECT query in SQL? Actually, I have checked the syntax of ORDER by clause and Having clause with the help of this SQL Source but I am looking for depth information regarding this. If anyone knows please explain me.

  • Good gosh, that's not a short list. You have DISTINCT and TOP in the SELECT list. ON in the JOIN criteria, plus APPLY, PIVOT and UNPIVOT. WHERE of course including GROUP BY, HAVING & ORDER BY. You could also argue for the inclusion of AS, sub-queries, correlated sub-queries and Common Table Expressions (CTE). That's a giant list to provide explanations for in a forum post.

    Instead, I'll just point you to the top of the screen. There's a choice up there called "Stairways". Click on that. There are several series of articles on the fundamentals of T-SQL. That will have a very detailed answer what each of the common clauses are.

    If you have a more specific question though, ask a way.

    ----------------------------------------------------
    The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
    Theodore Roosevelt

    The Scary DBA
    Author of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd Edition
    Product Evangelist for Red Gate Software

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply