REAL-TIME

VBA Projects

Full Access with Source Code
  • Designed and Developed by PNRao

  • Full Access with VBA Source Code

  • Well Commented Codes Lines

  • Creative and Professional Design

Effortlessly
Manage Your Projects

120+ Project Management Templates

Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

120+ PM Templates Includes:
  • 50+ Excel Templates

  • 50+ PowerPoint Templates

  • 25+ Word Templates

Share Post

SQL Operators helps us to write expressions in SQL queries. We use Arithmetic Operators, Comparison Operators, Logical Operators and Wildcard Operators while extracting and summarizing the data for analysis.

SQL Arithmetic Operators

Following are the list of all the arithmetic operators available in SQL, assume variable a holds 100 and variable b holds 200 then:

Operator Description Example
+ Addition – Adds values on either side of the operator a + b will give 300
Subtraction – Subtracts right hand operand from left hand operand a – b will give -100
* Multiplication – Multiplies values on either side of the operator a * b will give 2000
/ Division – Divides left hand operand by right hand operand b / a will give 20
% Modulus – Divides left hand operand by right hand operand and returns remainder b % a will give 0

SQL Comparison Operators

Following are the list of all the comparison operators available in SQL, assume variable a holds 100 and variable b holds 200 then:

Operator Description Example
= Checks if the value of two operands are equal or not, if yes then condition becomes true. (a = b) is not true.
!= Checks if the value of two operands are equal or not, if values are not equal then condition becomes true. (a != b) is true.
<>  Checks if the value of two operands are equal or not, if values are not equal then condition becomes true. (a <> b) is true.
Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (a > b) is not true.
Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. (a < b) is true.
>= Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. (a >= b) is not true.
<= Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. (a <= b) is true.
!< Checks if the value of left operand is not less than the value of right operand, if yes then condition becomes true. (a !< b) is false.
!> Checks if the value of left operand is not greater than the value of right operand, if yes then condition becomes true. (a !> b) is true.

SQL Logical Operators

Following are the list of all the logical operators available in SQL:

Operator Description
ALL The ALL operator is used to compare a value to all values in another value set.
AND The AND operator allows the existence of multiple conditions in an SQL statement’s WHERE clause.
ANY The ANY operator is used to compare a value to any applicable value in the list according to the condition.
BETWEEN The BETWEEN operator is used to search for values that are within a set of values, given the minimum value and the maximum value.
EXISTS The EXISTS operator is used to search for the presence of a row in a specified table that meets certain criteria.
IN The IN operator is used to compare a value to a list of literal values that have been specified.
LIKE The LIKE operator is used to compare a value to similar values using wildcard operators.
NOT The NOT operator reverses the meaning of the logical operator with which it is used. Eg. NOT EXISTS, NOT BETWEEN, NOT IN etc. This is negate operator.
OR The OR operator is used to combine multiple conditions in an SQL statement’s WHERE clause.
IS NULL The NULL operator is used to compare a value with a NULL value.
UNIQUE The UNIQUE operator searches every row of a specified table for uniqueness (no duplicates).

SQL Wildcard Operators

Following are the list of all the wildcard operators available in SQL, we use wildcard operators in conjunction with the LIKE operator:

Operator Description
The percent sign (%) Matches one or more characters. Note: MS Access uses the asterisk (*) wildcard character instead of the percent sign (%) wildcard character.
The underscore (_) Matches one character. Note: MS Access uses a question mark (?) instead of the underscore (_) to match any one character.
Character list to match (
[character list])
Sets and ranges of characters to match.
Character list not to match (^[character list]) Sets and ranges of characters to match.

Examples:

SQL Statement Description

Select * From Employee Where Name Like ‘M%’

Returns all the records where name starts with M

Select * From Employee Where Salary Like ‘2___0’

Returns all the records where it finds salary with a five-digit number that start with 2 and end with 0

Select * From Employee Where Department Like ‘[A-H]%’

Returns all the records where Department name start with any letter between A and H
Select * From Employee Where Department Like ‘^[A-H]%’

Returns all the records where Department name not start with any letter between A and H
Effortlessly Manage Your Projects and Resources
120+ Professional Project Management Templates!

A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

Save Up to 85% LIMITED TIME OFFER
Project Management Templates

All-in-One Pack
120+ Project Management Templates

Essential Pack
50+ PM Templates

Excel Pack
50+ Excel PM Templates

PowerPoint Pack
50+ Excel PM Templates

MS Word Pack
25+ Word PM Templates

Ultimate Project
Management Template
Ultimate Resource
Management Template
Project Portfolio
Management Templates
Categories: SQLTags: Last Updated: January 13, 2013

One Comment

  1. MANOHARAN January 8, 2016 at 4:34 PM

    SIR THE B/M QUERY IS NOT WORKING PLEASE ASSIST ME

    Sub CheckVendor()

    Dim CnTDS As New ADODB.Connection
    Dim StCNTDS As String
    Dim DBPath As String
    Dim StRsVendor As String
    Dim RsVendor As New ADODB.Recordset

    DBPath = ThisWorkbook.FullName
    StCNTDS = “Provider=MSDASQL.1;DSN=Excel Files;DBQ=” & DBPath & “;HDR=Yes’;”
    CnTDS.Open StCNTDS

    StRsVendor = “Select [CREDITORS$].[Account Code],[CREDITORS$].[Name]” & _
    “From [CREDITORS$],[MASTER$]” & _
    “Where [CREDITORS$].[Account Code] [MASTER$].[Account Code]” & _
    “Group By [CREDITORS$].[Account Code],[CREDITORS$].[Name];”

    RsVendor.Open StRsVendor, CnTDS

    Sheets(“NotFound”).Range(“A2”).CopyFromRecordset RsVendor

    ‘RsVendor.RecordCount = Nothing

    End Sub

Leave A Comment