Last answered:

20 May 2023

Posted on:

05 May 2023

0

Resolved: Adding new tables, does it make sense to use IF NOT EXISTS

When creating a new table, does it make sense to use the IF NOT EXISTS command or is this redudant?

2 answers ( 1 marked as helpful)
Instructor
Posted on:

05 May 2023

0

Hi David!
Thanks for reaching out.


In case there is such a DB you will obtain an error message that this database has already been created. Using IF NOT EXISTS will check for this database and then create it. If you already have created it, you will obtain a warning message, but not an error message.


Hope this helps.
Best,
Tsvetelin

Posted on:

20 May 2023

1

The word if exists is a checker that verfiy if the database or table existence on the server, sometimes We use the word 'Drop if exists' which means Delete the database or table if the database name or table name exists, Howevere, it's not adviceable to drop without backing up when there's an existing database or table on the server. 

Submit an answer