Tutorial A Beginer Guide To Use Of Operators In Database

Swati Mishra

Yellow Belt
By using these Operators rows will display with multiple conditions.

We can define many types of Operators which are described below:

  • Logical Operators
  • Comparison Operators
  • Range Operators
  • List Operators


Logical Operators:

We are commonly using these three logical operators in database which are used for multiple conditions.
  1. OR Operator: If any condition will true then the result will display.
  2. AND Operator: If all conditions will true then the result will display.
  3. NOT Operator: It expresses that Operator has to do nothing and give neutral value.

Syntax of all these three operators (OR/AND/NOT):

SELECT column list
FROM table name
WHERE conditional expression (OR/AND/NOT) conditional expression

Comparison Operators:

These are the list of comparison operators which displays rows based on condition.

Equal to (=)
Greater than (>)
Less than (<)
Greater than equal to (>=)
Less than equal to (<=
Not equal to (<>,! =)
Not greater than (!>)
Not less than (! <)




Syntax:

SELECT column list
FROM table name
WHERE expression 1 Comparison operators (=/ >/ </ <=/ >=/ !>/ !<) expression 2


Example:

SELECT Title
From Titles
WHERE Type = ‘business’
Above example displays the name of those book from Titles table which book type is business


Range Operators:

These are the Range operators are used to retrieve data can be explore in ranges.
Which are describing below:
  • BETWEEN: In use of WHERE clause BETWEEN is the meaning to search in range of specified term.
  • NOT BETWEEN: However, the clause not makes BETWEEN of meaning is to not include the rows in search results.

Syntax:

SELECT column list
FROM table name
WHERE expression1 Range Operator expression 2 AND expression3

Where expressions1, expression2, expression3 may be any valid combination of constants, variable, function, or column based expression. And the Range Operator is any valid range operator.

Example of BETWEEN Operators:

SELECT Title FROM Titles
WHERE Advance between 4000 AND 8000

Example of NOT BETWEEN Operators:


SELECT Title FROM Titles
WHERE Advance NOT BETWEEN 6000 AND 10000

LIST Operators: These are the two operators used in List Operators. Which are describing below:
  1. IN Operator: The IN Operator that permit the selection for values that match one of the value in the list.

  1. NOT IN Operator: The NOT IN Operator are opposite of IN Operator. This operator will not permit the selection for values that match any one of the value in the list.


Syntax:
SELECT column list
FROM table name
WHERE expression List operator value_list
Where value_ list is the list of values.

Summarize the Database operators:
  • A DBMS is consists of a server that helps users to interacts with a database having tables and a client to access data.

  • Structured query language or SQL is a languages that to access the data from the database.


  • Structured query language is the one that provides a long list of various used operators.

  • IF a string is included in the data this could be the query statement in the result data.


  • This is a customized implementation of the simple query languages that is also known as T-SQL.

  • By specifying the column names the SELECT statement is able to retrieve the data from column.


  • There are two possible headings by specifying the simple query languages. The first method is column that should be specified before the column and the second method is column name before the headings.

  • The result of the data is more readable and understanding in the data query if there is inclusion of the SELECT statement.


  • All the arithmetic operations like, addition, subtraction, divide and multiply in numeric fields can be performed and supported by the SQL server.
 
Top