Back to: Oracle Tutorials for Beginners and Professionals
Clauses in Oracle with Examples
In this article, I am going to discuss Clauses in Oracle with Examples. At the end of this article, you will understand what are clauses, why do we need clauses, and the different types of clauses supported by the Oracle database.
What are clauses in Oracle?
If you want to provide the SQL Query with some additional functionalities such as filtering the records, sorting the records, fetching the records, and grouping the records then you need to use the Clauses along with the SQL Query. So, in simple words, we can say that clauses are used to provide some additional functionalities.
So, in simple words, we can say that clauses are statements that are used to add to SQL pre-define query for providing additional facilities are like filtering rows, sorting values, grouping similar values, finding subtotal and grand total based on the given values automatically.
Why do we need Clauses in Oracle?
Clauses are used for database access and data extraction by applying a filter that describes the conditions. If the condition is satisfied, we will get the particular result rows and the information that does not satisfy the condition is not used. So, Clauses helps us to access proper info and is manageable to deal with different tables in a database.
Types of Clauses in Oracle:
Oracle database supports the following clauses.
- WHERE: Filtering rows (before grouping data)
- ORDER BY: Sorting values
- GROUP BY: Grouping similar data
- HAVING: Filtering rows (after grouping data)
- ROLLUP: Finding subtotal & grand total (single column)
- CUBE: Finding subtotal & grand total (multiple columns)
- FETCH FIRST: To Return top n Number of Records
Syntax: <SQL PER-DEFINE QUERY> + <CLAUSES>;
In the next article, I am going to discuss the WHERE Clause in Oracle with Examples. Here, in this article, I try to explain Clauses in Oracle with Examples and I hope you enjoy this Clauses in Oracle with Examples article.