Category: SQL Clause
-
HAVING Clause in SQL
The HAVING clause places the condition in the groups defined by the GROUP BY clause in the SELECT statement. This SQL clause is implemented after the ‘GROUP BY’ clause in the ‘SELECT’ statement. This clause is used in SQL because we cannot use the WHERE clause with the SQL aggregate functions. Both WHERE and HAVING…
-
SQL SELECT AS
Here, the Column_Name is the name of a column in the original table, and the New_Column_Name is the name assigned to a particular column only for that specific query. This means that New_Column_Name is a temporary name that will be assigned to a query. Assigning a temporary name to the column of a table: Let…
-
SQL WITH CLAUSE
The SQL WITH clause is used to provide a sub-query block which can be referenced in several places within the main SQL query. It was introduced by oracle in oracle 9i release2 database. There is an example of employee table: Syntax for the SQL WITH clause – This syntax is for SQL WITH clause using…
-
SQL OR
The SQL OR condition is used in SQL query to create a SQL statement where records are returned when any one condition met. It can be used in a SELECT statement, INSERT statement, UPDATE statement or DELETE statement. Let’s see the syntax for the OR condition: ID First_Name Last_Name Department Location 1 Harshad Kuwar Marketing Pune 2 Anurag Rajput IT Mumbai 3 Chaitali Tarle IT…
-
SQL AND
Consider we have an employee table created into the database with the following data: ID First_Name Last_Name Department Location 1 Harshad Kuwar Marketing Pune 2 Anurag Rajput IT Mumbai 3 Chaitali Tarle IT Chennai 4 Pranjal Patil IT Chennai 5 Suraj Tripathi Marketing Pune 6 Roshni Jadhav Finance Bangalore 7 Sandhya Jain Finance Bangalore SQL…
-
SQL WHERE
A WHERE clause in SQL is a data manipulation language statement. WHERE clauses are not mandatory clauses of SQL DML statements. But it can be used to limit the number of rows affected by a SQL DML statement or returned by a query. Actually. it filters the records. It returns only those queries which fulfill the specific…