“Create table if not exists” - how to check the schema, too?
Is there a (more or less) standard way to check not only whether a table named mytable exists, but also whether its schema is similar to what it should be? I'm experimenting with H2 database , and CREATE TABLE IF NOT EXISTS mytable (....) statements apparently only check for the table´s name . I would expect to get an exception if there's a table with the given name, but different schema. CREATE TABLE IF NOT EXISTS ... is not a standard SQL code. The thing to do is to check if the table is already in the catalogue. For instance, in Java you may do something like: connection.getMetaData()