Labels

Thursday, April 21, 2022

Operators in SQL (Part -6)

 SQL Operators are special Words or Characters used to perform specific tasks both mathematical and logical computations on operands, which use ‘WHERE’ clause in a SQL query / statement.

There are six types of SQL operators that we are going to cover: Arithmetic, Bitwise, Comparison, Compound, Logical and String.

Every database administrator and user uses SQL queries for manipulating and accessing the data of database tables and views with the help of reserved words and characters, which are used to perform arithmetic operations, logical operations, comparison operations, compound operations, etc.

SQL Operators

Description

Arithmetic

Add (+), Subtract (-), Multiply (*), Divide (/), Modulo (%)

Bitwise

AND (&), OR (|), exclusive OR (^)

Comparison

Equal to (=), Greater than (>), Less than (<), Greater than or equal to (>=), Less than or equal to (<=), Not equal to (<>)

Compound

Add equals (+=), Subtract equals (-=), Multiply equals (*=), Divide equals (/=), Modulo equals (%=), Bitwise AND equals (&=), Bitwise exclusive equals (^-=), Bitwise OR equals (|*=)


Few Examples:

Not Equal’ (<>) Operator: The! = symbol is used to filter results that do not equal a certain value.


b)    LIKE” Operator: The LIKE operator searches for a specified pattern in a column.

This operator is used in the WHERE clause with the following three statements:

  1. SELECT statement
  2. UPDATE statement
  3. DELETE statement


c) NOT LIKE” Operator:


d)      IN’ Operator: in SQL allows database users to specify two or more values in a WHERE clause. This logical operator minimizes the requirement of multiple OR conditions.



No comments:

Post a Comment