MySQL | 2 Solutions using LIKE and RLIKE (REGEX matching)
Pattern matching using LIKE:\nSQL\nSELECT *\nFROM Patients\nWHERE conditions LIKE \'DIAB1%\' OR conditions LIKE \'% DIAB1%\'\n\n- We can add a white space to th
1. Pattern matching using `LIKE`:\n```SQL\nSELECT *\nFROM Patients\nWHERE conditions LIKE \'DIAB1%\' OR conditions LIKE \'% DIAB1%\'\n```\n- We can add a white space to the start of `conditions` to avoid searching for 2 different patterns:\n```SQL\nSELECT *\nFROM Patients\nWHERE CONCAT(\' \', conditions) LIKE \'% DIAB1%\'\n```\n\n2. REGEX pattern matching using `RLIKE`:\n```SQL\nSELECT *\nFROM Patients\nWHERE conditions RLIKE \'\\\\bDIAB1\'\n```\n- `\\b` in regex refers to word boundaries. So `\\\\bDIAB1` matches any string with a word that starts with `DIAB1`.
['MySQL']