What is the difference between using 'LIKE' and 'LEFT' in a SQL statement in PHP?

When using 'LIKE' in a SQL statement in PHP, you are performing a pattern matching search on a specific column. This is useful when you want to search for partial matches in a column. On the other hand, when using 'LEFT' in a SQL statement, you are extracting a specified number of characters from the beginning of a string column. This is useful when you want to retrieve a specific portion of the data in a column.

// Using LIKE in a SQL statement
$query = "SELECT * FROM table_name WHERE column_name LIKE '%search_term%'";
$result = mysqli_query($connection, $query);

// Using LEFT in a SQL statement
$query = "SELECT LEFT(column_name, 5) AS extracted_data FROM table_name";
$result = mysqli_query($connection, $query);