Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SQL Tutorial -> Sql LIKE Operator

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 292
    Comment on it

    <-- Chapter 9: SQL != Operator

    Chapter 10

    SQL LIKE Operator


    Lets see an example from the below table "employees" :-


    employee_id name code designation salary
    101 ABC E-101 Engineer 12000
    102 DEF E-102 Doctor 8000
    103 GHI E-103 Software Developer 8000
    104 JKL E-104 CEO 12000
    105 MNO E-105 Software Developer 100000

    LIKE Operator Example


    SELECT * 
    FROM `employees`
    WHERE `name` LIKE '%HI%';
    

    Now Run this Query, we will see the output below :-


    employee_id name code designation salary
    103 GHI E-103 Software Developer 8000

    We can see here, that only the record is displayed which column name value matches the pattern "HI" . LIKE Operator has some other functioning also. Lets see those Examples too below :-


    SELECT *
    FROM `employees`
    WHERE `designation` LIKE 's%';
    

    Now Run this Query, we will see the output below :-


    employee_id name code designation salary
    103 GHI E-103 Software Developer 8000
    105 MNO E-105 Software Developer 100000

    We can see here, that only the record is displayed which column designation value starts with the letter "s".Lets see the other Example below


    SELECT *
    FROM `employees`
    WHERE `designation` LIKE '%er';
    

    Now Run this Query, we will see the output below :-


    employee_id name code designation salary
    101 ABC E-101 Engineer 12000
    103 GHI E-103 Software Developer 8000
    105 MNO E-105 Software Developer 100000

    We can see here, that only the record is displayed which column designation value ends with the letter "er".


    Chapter 11: SQL BETWEEN Operator -->

 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: