SQLforGeeks
  • Home
  • SQL
  • SQL Tutorial
  • SQL Syntax
  • Our Services
Contact
  1. SQL
  2. SQL Arithmetic operators

Text copied!

« Previous
Next »

SQL Arithmetic operators

May 19, 2023, 7:51 p.m. under SQL

  • Hi! You should check SQL operators post first.

    In SQL, Operators are special character, symbol or a keyword that is used to perform some specific operations. For example : comparing data

    SQL operators are commonly used with SQL statements to retrieve, filter, and manipulate data.

    SQL arithmetic operators can be used to perform mathematical calculation on numeric data types such as int, float and decimal.

    Overview of SQL arithmetic operators :
    • Addition   +
    • Subtraction   -
    • Multiplication   *
    • Division   /
    • Modulo   %
            
    SELECT 2 + 1 AS [Addition] 
    SELECT 2 - 1 AS [Subtraction]
    SELECT 2 * 1 AS [Multiplication]
    SELECT 10 / 2 AS [Division]
    SELECT 10 % 3 AS [Modulo]
            
    SQL Arithmetic operators
    1. Addition :

    It is a operator denoted by plus (+) symbol and use to add two numerical values together.

    For example : if you have two numerical values as 2 and 1. The addition of these two numbers will result 3.

    2 + 1 = 3
            
    2. Subtraction :

    It is a operator denoted by minus (-) symbol and use to subtract one numerical value from another numerical value. Basically it calculates the difference between two numbers.

    For example : if you have two numerical values as 2 and 1. The subtraction of value 1 from value 2 will result 1.

    2 - 1 = 1
            
    3. Multiplication :

    It is a operator denoted by asterisk (*) symbol and use to multiply two numerical values together.

    For example : if you have two numerical values as 2 and 1. The multiplication of these two numbers will result 2.

    2 * 1 = 2
            
    4. Division :

    It is a operator denoted by forward slash (/) symbol and use to divide one numerical value by another numerical value.

    For example : if you have two numerical values as 10 and 2. The division of these two numbers will result 5.

    10 / 2 = 5
            
    5. Modulo :

    It is a operator denoted by percent (%) symbol and use to calculate remainder when one numerical value is divided by another numerical value.

    For example : if you have two numerical values as 10 and 3. The remainder of these two numbers will result 1.

    10 % 3 = 1
            
    To enhance your understanding of 'SQL operators', be sure to check out our next tutorial.

    Frequently Asked Questions :

    What are the arithmetic operators in SQL?

    Arithmetic operators in SQL include addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).

    What are the 5 arithmetic operators?

    The five arithmetic operators in SQL are addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).

    What is => in SQL?

    In SQL, "=>" is not a valid operator; it is commonly used in other programming languages like PHP, but not in SQL.

    What is the precedence of arithmetic operators in SQL?

    The precedence of arithmetic operators in SQL follows the typical mathematical rules: multiplication and division have higher precedence than addition and subtraction.
    Thank You! You should check SQL comparison operators post next.
    « Previous
    Next »
    RELATED :

    What is SQL

    What is T-SQL

    Difference between DBMS and Data Warehouse

    Download SQL Server

    Install SQL Server

    Download SQL Server Management Studio SSMS

    SQL Server Management Studio

    SQL Database

    Download database

    Restore database

    Backup database

    Attach database

    Detach database

    Create database

    Delete database

    Rename database

    Select database

    Database offline

    Database online

    SQL Commands

    SQL Tables

    Create table

    Truncate table

    Delete table

    Rename table

    Select table

    Alter table

    SQL Data Types

    SQL Comments

    SQL Constraints

    SQL Joins

    SQL inner join

    SQL left join

    SQL right join

    SQL full join

    SQL cross join

    SQL self join

    INSERT INTO SELECT statement

    INSERT INTO statement

    SQL Clauses

    SELECT clause

    FROM clause

    WHERE clause

    GROUP BY clause

    HAVING clause

    ORDER BY clause

    JOIN clause

    UNION clause

    UNION ALL clause

    TOP clause

    DISTINCT clause

    SQL Operators

    SQL Comparison operators

    SQL Logical operators

    UNION operator

    UNION ALL operator

    INTERSECT operator

    EXCEPT operator

    LIKE operator

    NOT LIKE operator

    IN operator

    NOT IN operator

    IS NULL operator

    IS NOT NULL operator

    EXISTS operator

    NOT EXISTS operator

    BETWEEN operator

    NOT BETWEEN operator

    SQL Functions

    SQL Built-In functions

    CHARINDEX function

    DATEADD function

    CONCAT function

    LEN function

    REPLACE function

    SUBSTRING function

    CASE statement

    GETDATE function

    DATEPART function

    DATEDIFF function

    CAST function

    TRY_CAST function

    CONVERT function

    TRY_CONVERT function

    ISNULL function

    NULLIF function

    COALESCE function

    SQL Window functions

    ROW_NUMBER function

    RANK function

    DENSE_RANK function

    IIF function

    CHOOSE function

    SQL Store Procedure

    Store Procedure vs. Function

    SQL Subquery

    SQL Aliases

    Temp table

    SQL Error Handling

    SQL Variables

    SQL Views

    SQL Merge

    SQL CTE

    SQL WITH TIES

    Define Transaction in DBMS

    ACID properties in DBMS

    Types of Triggers in DBMS


    • Have Some Questions?
    logo

    Elevate your data experience with SQL excellence

    Quick Links
    •  Home
    •  SQL Tutorial
    •  SQL Syntax
    •  Our Services
    Our Services
    • Web Development
    • BI Development
    • Data Warehousing
    • Data Integration ETL


    Follow Us

    GST Registered: XXAXXXXXXXZX
    Mumbai, Maharashtra, India support@sqlforgeeks.com

    © 2025 Copyright™ | All Rights Reserved | Privacy Policy