Home  >  Article  >  Database  >  Check if a table in MySQL exists and show a warning if it exists?

Check if a table in MySQL exists and show a warning if it exists?

WBOY
WBOYforward
2023-08-29 15:53:02713browse

Check if a table in MySQL exists and show a warning if it exists?

To check if the table exists or not use the following syntax −

CREATE TABLE IF NOT EXISTS yourTableName
(
   yourColumnName1 dataType,
   .
   .
   .
   .
   N
);

Here we will try to create an already existing table then it will generate a warning message "Table already exists". Let's first create a table. This table already exists. ##

The above is the detailed content of Check if a table in MySQL exists and show a warning if it exists?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete