Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SQL: WHERE ,AND and OR Clause

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 444
    Comment on it

    1. SQL WHERE Clause:-

    SQL WHERE Clause is one of the most useful feature of the SQL query as it is used to specify a condition while fetching the data from single table or joining with multiple tables,it also allows you to select specific rows i.e only certain rows of the table are displayed, based on the criteria in that Where clause. It is used in different statements like SELECT,UPDATE, DELETE statement, etc.

    Syntax:-

    SELECT column_name FROM table_name WHERE [condition]

    Example:-

    SELECT City FROM Clients WHERE Country='Mexico';

    2.SQL AND & OR Clause:-

    In SQL query multiple simple conditions are connected by AND or OR to form compound conditions without any limits that how many simple conditions can be connected in a single SQL statement.

    Basically AND & OR clause are used to filter out records based on more than one condition and also narrow data in an SQL statement. These two operators are called conjunctive operators.

    Syntax:-

    SELECT column_name

    FROM table_name

    WHERE simple condition

    {[AND|OR] simple condition}

    Example:-

    Eg:-For AND Clause

    SELECT Salary

    FROM Clients

    WHERE Salary>'5000';

    AND Age='50';

    Eg:-For OR Clause

    SELECT Salary

    FROM Clients

    WHERE Salary>'5000'

    OR Age='50';

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: