 # PostgreSQL Operators

#### Chapter 5 5 Steps - 3 Clicks

# PostgreSQL Operators

### Description

PostgreSQL Operator is a symbol that instructs the compiler to execute some particular logical manipulation and mathematical operation. PostgreSQL Operators contains some of the operators by default, such as:

### Description

Arithmetic operators execute one or more numeric values and returns the output of a numeric value. The following are the arithmetic PostgreSQL Operators.

Operator Description Example
+ Performs addition of two numbers. A+B, Example 10+5=15.
Performs subtraction of two numbers. A-B, Example 10-5=5.
* Performs multiplication of two numbers. A*B,Example 10*5=50.
/ Performs division of two numbers. A/B, Example 10/5=2.

### Description

Comparison PostgreSQL Operators compares one expression with another, thereby giving a consistent result as NULL, TRUE OR FALSE.

Operator Description Example
= Analyse whether the two values are True or False, if true, then the case will be true. A=B.
< Analyse whether the left value is less than the right value, if true, then the case becomes true. A<B
> Analyse whether the left value is greater than the right value, if true, then the case will be true. A>B
<= Analyse whether the left value is less than or equal to the right value, if yes, then the case becomes true. A<=B
>= Analyse whether the left value is greater than or equal to the right value, if true, then the case becomes true. A>=B

### Description

Logical PostgreSQL Operators on two operands and returns a boolean value as the output. The accessible logical operators are AND, OR and NOT.

Operator Description
AND It is called as logical AND operator. If two values are true, then the case becomes true.
OR It is called as logical OR operator, suppose any one value is true, then the case become true.
NOT It is called as logical NOT operator, if a case is true, then the logical NOT operator will make it false.

### Description

A string is defined as the succession of characters with a discretionary size specifications. The characters can be special characters, letters, numeric, and accumulation of whole sequence or blanks. There are three sorts of strings, for example, These objects are variable-length strings that range to 128.

While declaring a string, the developer will determine the length. The string is protected with spaces to the length as indicated.

The greatest length of variable-length string reaches to 32,767.

### Description

These postgreSQL Bitwise operator performs on bits and execute bit by bit executions. And the operation for truth table will be as follows.

p q p&q p|q
0 0 0 0
0 1 0 1
1 1 1 1
1 0 0 1

### Key Points

• PostgreSQL Operator – It is a symbol that instructs the compiler to execute some particular operations.
• Arithmetic operator – Executes one or more numeric values and returns the result set.
• Comparison operator – Compares one expression with another.
• Logical operator – Operates on two operands and returns a boolean output.
• String operator – A sequence of characters with an discretionary size specifications.
• Bitwise operator – Executes bit by bit executions.