What is the full syntax of a SELECT query?

the full syntax of a SELECT query with all the possible CLAUSES is:


SELECT column_list | *
FROM table_name 
[ JOIN table_name1 ON join_condition ]
[ JOIN table_name2 ON join_condition .. ]
[ WHERE query_condition ]
[ GROUP BY group_by_column_list expression ]
[ HAVING query_condition ]
[ ORDER BY column_list [ ASC | DESC ]
 

In this syntax:

  • column_list is where the list of desired columns is mentioned.
  • JOIN conditions to link results from more than one tables which are related by common column(s) or key(s)
  • WHERE condition to specify the filtering condition on the result dataset
  • GROUP BY to aggregate the result data based one or more columns
  • HAVING is a secondary condition to apply on the data that is grouped using the GROUP BY clause
  • ORDER BY is to sort the final dataset based on one or more columns.

the full syntax of a SELECT query with all the possible CLAUSES is:


SELECT column_list | *
FROM table_name 
[ JOIN table_name1 ON join_condition ]
[ JOIN table_name2 ON join_condition .. ]
[ WHERE query_condition ]
[ GROUP BY group_by_column_list expression ]
[ HAVING query_condition ]
[ ORDER BY column_list [ ASC | DESC ]
 

In this syntax:

  • column_list is where the list of desired columns is mentioned.
  • JOIN conditions to link results from more than one tables which are related by common column(s) or key(s)
  • WHERE condition to specify the filtering condition on the result dataset
  • GROUP BY to aggregate the result data based one or more columns
  • HAVING is a secondary condition to apply on the data that is grouped using the GROUP BY clause
  • ORDER BY is to sort the final dataset based on one or more columns.
Default image
Sriram Mannava

I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity.

Leave a Reply