MYSQL - “LIKE operator”
MYSQL - “LIKE operator” The LIKE operator is used in a WHERE clause to search for a pattern in a column. Two wildcards are often used while using the LIKE operator: Percentage sign( % ) — it represents multiple characters ,zero ,one. Underscore sign( _ ) — it represents single character. Create database before creating a table. commands : CREATE DATABASE pannts_db, USE pants_db creating pants_db table and inserting values LIKE ‘J%’ — finds any value that starts with “J” In the below syntax it shows the values from “ Article column ” where the value starts with “J” . LIKE ‘J%’. It shows only those values as per the condition described. LIKE ’J%’ LIKE ‘%e’ — finds any values that ends with “e” In the below syntax it shows the values from “ color column ” where the value ends with the letter ”e”. LIKE ‘%e’. It shows only those rows as per the condition described. LIKE ‘%e’ LIKE ‘%a%’ — finds any values that have or in any position. In the below syntax it shows values from “ Article