What are the advantages of using table aliases instead of numerical aliases in PHP SELECT queries?

Using table aliases instead of numerical aliases in PHP SELECT queries can make the code more readable and maintainable. Table aliases provide a clear and meaningful reference to the tables being queried, making it easier for developers to understand the query logic. Additionally, table aliases can help avoid conflicts and ambiguities when joining multiple tables in a query.

// Using table aliases in a PHP SELECT query
$query = "SELECT p.id, p.name, c.category_name
          FROM products p
          JOIN categories c ON p.category_id = c.id";

$result = mysqli_query($connection, $query);

// Fetching and displaying results
while ($row = mysqli_fetch_assoc($result)) {
    echo $row['id'] . ' - ' . $row['name'] . ' - ' . $row['category_name'] . '<br>';
}