Author: Awais Farooq

  • 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…

  • SELECT NULL

    First of all we should know that what null value is? Null values are used to represent missing unknown data. There can be two conditions: If in a table, a column is optional, it is very easy to insert data in column or update an existing record without adding a value in this column. This…

  • SELECT SUM

    It is also known as SQL SUM() function. It is used in a SQL query to return summed value of an expression. Let’s see the Syntax for the select sum function: expression may be numeric field or formula. This would produce the following result. ID EMPLOYEE_NAME SALARY 1 JACK REACHER 32000 2 PADMA MAHESHWARI 22000…

  • SELECT DATE

    SQL SELECT DATE is used to retrieve a date from a database. If you want to find a particular date from a database, you can use this statement. For example: let’s see the query to get all the records after ‘2013-12-12’. Let’s see the another query to get all the records after ‘2013-12-12’ and before ‘2013-12-13’…

  • SELECT from Multiple Tables

    This statement is used to retrieve fields from multiple tables. To do so, we need to use join query to get data from multiple tables. Let’s see the example for the select from multiple tables: Let us take three tables, two tables of customers named customer1 and customer2 and the third table is product table.…