What are the advantages of using the "LIKE" keyword in the CREATE TABLE statement when copying tables in PHP?

When copying tables in PHP using the CREATE TABLE statement, the "LIKE" keyword can be used to quickly create a new table with the same structure as an existing table. This can save time and effort by avoiding the need to manually define the columns, data types, and constraints of the new table. Additionally, using the "LIKE" keyword ensures that the new table inherits any indexes, primary keys, and default values from the original table.

// Create a new table in the database using the structure of an existing table
$sql = "CREATE TABLE new_table LIKE existing_table";
$result = mysqli_query($conn, $sql);

if($result) {
    echo "Table created successfully.";
} else {
    echo "Error creating table: " . mysqli_error($conn);
}