sql - Does CREATE DATABASE overwrite? -


i writing simple sql script , need create new database if doesn't exist, or leave database alone if exist (and not overwrite or drop-n-swap tables).

i need ansi-compliant; according w3 schools:

create database my_db; 

...is ansi-compliant. state behavior if my_db exists.

so ask: how write ansi-compliant sql creates my_db if doesn't exist, or doesn't if exist? in advance!

the command you're using specified per vendor, , specification (at least sql:2008 (12.1mb zip archive)) not mention implementation creation of database, leaving details individual vendor.

its possible have rdbms overwrite when issued create database in personal experience unlikely. best option here test each rdbms vendor's product intend support.


Comments