Category: Operators and Clauses

  • Alias Syntax

    You can rename a table or a column in a database temporarily by giving them another pseudo name. This pseudo name is known as Alias. The use of aliases is to address a specific table or a column in an SQL statement without changing their original name in the database. Aliases are created with the AS keyword. Aliases…

  • EXCEPT

    The SQL EXCEPT Operator The EXCEPT operator in SQL is used to retrieve all the unique records from the left operand (query), except the records that are present in the result set of the right operand (query). In other words, this operator compares the distinct values of the left query with the result set of the right…

  • INTERSECT

    In mathematical set theory, the intersection of two sets is a collection of values that are common to both sets. In real-time scenarios, there will be a huge number of tables in a database that contains information. The user may find it challenging to gather common information from various tables. So we use the INTERSECT…

  • UNION vs UNION ALL

    UNION and UNION ALL operators are just the SQL implementation of algebraic set operators. Both of them are used to retrieve the rows from multiple tables and return them as one single table. The difference between these two operators is that UNION only returns distinct rows while UNION ALL returns all the rows present in the tables. However,…

  •  UNION Operator

    The SQL UNION Operator The SQL UNION operator is used to combine data from multiple tables by eliminating duplicate rows (if any). To use the UNION operator on multiple tables, all these tables must be union compatible. And they are said to be union compatible if and only if they meet the following criteria −…

  • BETWEEN Operator

    The SQL BETWEEN Operator The BETWEEN operator is a logical operator in SQL, that is used to retrieve the data within a specified range. The retrieved values can be integers, characters, or dates. You can use the BETWEEN operator to replace a combination of “greater than equal AND less than equal” conditions. Let us understand it in a better…

  • NOT NULL Constraint

    In a table, columns can typically accept NULL values by default. However, if you want to ensure that a particular column does not contain NULL values, you need to add the NOT NULL constraint/condition on that column. The SQL NOT NULL Constraint The NOT NULL constraint in SQL is used to ensure that a column in a…

  • IS NOT NULL

    A NULL value indicates a missing or unknown value. It appears to be blank and does not contain any data. It is very important to understand that a NULL value is different than a zero value or a field that contains spaces. For checking null values we can use two basic operators. The SQL IS…

  • IS NULL

    Let’s assume a table with NULL values in some of its fields. These fields indicate that no values are present in them. SQL allows users to create new records or modify existing ones without specifying a value for a field. If no value is provided, the field is stored with a NULL value. In SQL,…

  • Not Equal

    The SQL NOT EQUAL Operator The SQL NOT EQUAL operator is used to compare two values and return true if they are not equal. It is represented by “<>” and “!=”. The difference between these two is that <> follows the ISO standard, but != doesn’t. So, it is recommended to use the <> operator. We can use the NOT…