Page 139 - SQL
P. 139

//selects all customers with a City containing the pattern "es"
               SELECT * FROM Customers
                WHERE City LIKE '%es%';


        _ - A substitute for a single character


         Eg://selects all customers with a City starting with any character, followed by "erlin"
         SELECT * FROM Customers
         WHERE City LIKE '_erlin';


        [charlist] - Sets and ranges of characters to match


         Eg://selects all customers with a City starting with "a", "d", or "l"
         SELECT * FROM Customers
         WHERE City LIKE '[adl]%';

         //selects all customers with a City starting with "a", "d", or "l"
         SELECT * FROM Customers
         WHERE City LIKE '[a-c]%';


        [^charlist] - Matches only a character NOT specified within the brackets


         Eg://selects all customers with a City starting with a character that is not "a", "p", or "l"
         SELECT * FROM Customers
         WHERE City LIKE '[^apl]%';

         or

         SELECT * FROM Customers
         WHERE City NOT LIKE '[apl]%' and city like '_%';


        Read LIKE operator online: https://riptutorial.com/sql/topic/860/like-operator








































        https://riptutorial.com/                                                                             121
   134   135   136   137   138   139   140   141   142   143   144