In SQLite, the table_list
pragma returns information about the tables and views in the schema.
It was first introduced in SQLite version 3.37.0 (released on 2021-11-27).
Continue readingIn SQLite, the table_list
pragma returns information about the tables and views in the schema.
It was first introduced in SQLite version 3.37.0 (released on 2021-11-27).
Continue readingIn MariaDB, we can use the IF EXISTS
clause of the DROP TABLE
statement to check whether the table exists or not before dropping it.
The very useful DROP TABLE IF EXISTS
syntax was finally introduced in Oracle Database – Oracle Database 23c to be precise. This syntax allows us to run a DROP TABLE
statement without getting an error if the table doesn’t exist.
Earlier versions of Oracle don’t support the IF EXISTS
clause. Therefore, if we want to avoid any nasty errors resulting from trying to drop a non-existent table, we need to do a bit of extra work.
Below are three options for dropping a table if it exists in Oracle.
Continue readingIn MySQL, we can use the IF EXISTS
clause of the DROP TABLE
statement to check whether the table exists or not before dropping it.
In SQLite, we can query the sqlite_schema
table to find out whether a given table exists.
Prior to SQLite version 3.33.0, this table was referred to as sqlite_master
(it can still be referred to as such in subsequent releases for backwards compatibility).
Here are four ways to check whether or not a table exists in a MariaDB database.
Continue readingBelow are five ways to check if a table exists in a PostgreSQL database.
Continue readingIn MariaDB, you can use the IF NOT EXISTS
clause of the CREATE TABLE
statement to check whether or not a table of the same name already exists in the database before creating it.
The table will only be created if there isn’t already one with the same name.
Continue readingIn PostgreSQL, you can use the IF NOT EXISTS
clause of the CREATE TABLE
statement to check whether or not a table of the same name already exists in the database before creating it.
The table will only be created if no other table exists with the same name. If a table already exists with that name, a “notice” will be issued instead of an error.
Continue readingIn MySQL, you can use the IF NOT EXISTS
clause of the CREATE TABLE
statement to check whether or not a table of the same name already exists in the database.
If the table doesn’t exist, it will be created. If it already exists, it won’t be created.
Continue reading