- Python Basics
- Interview Questions
- Python Quiz
- Popular Packages
- Python Projects
- Practice Python
- AI With Python
- Learn Python3
- Python Automation
- Python Web Dev
- DSA with Python
- Python OOPs
- Dictionaries
SQL Operators
SQL Operators perform arithmetic, comparison, and logical operations to manipulate and retrieve data from databases.
In this article, we will discuss Operators in SQL with examples, and understand how they work in SQL.
Operators in SQL
Operators in SQL are symbols that help us to perform specific mathematical and logical computations on operands. An operator can either be unary or binary.
The unary operator operates on one operand, and the binary operator operates on two operands.
Types of Operators in SQL
Different types of operators in SQL are:
- Arithmetic operator
- Comparison operator
- Logical operator
- Bitwise Operators
- Compound Operators
SQL Arithmetic Operators
Arithmetic operators in SQL are used to perform mathematical operations on numeric values in queries. Some common arithmetic operators are:
SQL Arithmetic Operators Example
In this example, we will retrieve all records from the “employee” table where the “emp_city” column does not start with the letter ‘A’.
SQL Comparison O perators
Comparison Operators in SQL are used to compare one expression’s value to other expressions. SQL supports different types of comparison operator, which are described below:
SQL Comparison Operators Example
In this example, we will retrieve all records from the “MATHS” table where the value in the “MARKS” column is equal to 50.
SQL Logical Operators
Logical Operators in SQL are used to combine or manipulate conditions in SQL queries to retrieve or manipulate data based on specified criteria..
SQL Logical Operators Example
In this example, retrieve all records from the “employee” table where the “emp_city” column is equal to ‘Allahabad’ and the “emp_country” column is equal to ‘India’.
SQL Bitwise Operators
Bitwise operators in SQL are used to perform bitwise operations on binary values in SQL queries, manipulating individual bits to perform logical operations at the bit level. Some SQL Bitwise Operators are:
SQL Compound Operators
Compound operator in SQL are used to perform an operation and assign the result to the original value in a single line. Some Compound operators are:
SQL Special Operators
Special operators are used in SQL queries to perform specific operations like comparing values, checking for existence, and filtering data based on certain conditions.
SQL Special Operator Example
In this example, we will retrieve all records from the “employee” table where the “emp_id” column has a value that falls within the range of 101 to 104 (inclusive).
SQL Operators are used to perform various operations on the data using SQL queries. These operators simplify arithmetic, comparison , logical, and bitwise operations on the data.
In this tutorial, we have explained SQL operators in detail. We have explained different types of operators in SQL along with their definition and examples. Using SQL operators you can efficiently perform operations on data.
Similar Reads
- sql-operators
Please Login to comment...
Improve your coding skills with practice.
What kind of Experience do you want to share?
Navigation Menu
Search code, repositories, users, issues, pull requests..., provide feedback.
We read every piece of feedback, and take your input very seriously.
Saved searches
Use saved searches to filter your results more quickly.
To see all available qualifiers, see our documentation .
- Notifications You must be signed in to change notification settings
assignment-operator-transact-sql.md
Latest commit, file metadata and controls, = (assignment operator) (transact-sql).
[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Parallel Data Warehouse fabricse fabricdw ]
The equal sign (=) is the only [!INCLUDE tsql ] assignment operator. In the following example, the @MyCounter variable is created, and then the assignment operator sets @MyCounter to a value returned by an expression.
The assignment operator can also be used to establish the relationship between a column heading and the expression that defines the values for the column. The following example displays the column headings FirstColumnHeading and SecondColumnHeading . The string xyz is displayed in the FirstColumnHeading column heading for all rows. Then, each product ID from the Product table is listed in the SecondColumnHeading column heading.
Operators (Transact-SQL) Compound Operators (Transact-SQL) Expressions (Transact-SQL)
IMAGES
VIDEO
COMMENTS
SQL Logical Operators. Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML …
+= (String Concatenation Assignment) : Concatenates two strings and sets the string to the result of the operation. For example, if a variable @x equals 'Adventure', then @x …
Adds two numbers and sets a value to the result of the operation. For example, if a variable @x equals 35, then @x += 2 takes the original value of @x, add 2 and sets @x to that …
Transact-SQL provides the following compound operators: Adds some amount to the original value and sets the original value to the result. Subtracts some amount from the …
SQL Operators perform arithmetic, comparison, and logical operations to manipulate and retrieve data from databases. In this article, we will discuss Operators in SQL with examples, and understand how they work in …
The assignment operator can also be used to establish the relationship between a column heading and the expression that defines the values for the column. The following …