In MariaDB, SHOW TABLES is an administrative statement that lists the non-TEMPORARY tables, sequences and views in a given database.
tables
3 Ways to Create a Table if it Doesn’t Already Exist in Oracle
The very useful CREATE TABLE IF NOT EXISTS syntax was finally introduced in Oracle Database – Oracle Database 23c to be precise. This syntax allows us to run a CREATE TABLE statement without getting an error if the table already exists.
Earlier versions of Oracle don’t support the IF NOT EXISTS clause, and so if we want to avoid any nasty errors resulting from trying to create a table that already exists, we need to do a bit of extra work.
4 Ways to Check if a Table Exists Before Dropping it in SQL Server (T-SQL)
Dropping a table in SQL easy. You simply use DROP TABLE myTable where myTable is the name of the table you want to drop. You can use this method to drop a table in SQL Server via T-SQL script.
But you’ll get an error if the table doesn’t actually exist. That is, unless you check for the existence of the table first.
Below are four ways of using T-SQL to check whether the table exists before dropping it.
How to Create a Table Only if it Doesn’t Exist in SQLite
In SQLite, you can use the IF NOT EXISTS clause of the CREATE TABLE statement to check whether or not a table or view of the same name already exists in the database before creating it.
Creating a table without this clause would normally result in an error if a table of the same name already existed in the database. But when using the IF NOT EXISTS clause, the statement has no effect if a table already exists with the same name.
DROP TABLE IF EXISTS Example in PostgreSQL
In PostgreSQL, we can use the IF EXISTS clause of the DROP TABLE statement to check whether the table exists or not before dropping it.
Check if a Table Exists in Oracle
In Oracle Database, there are a number of views that we can query to find out whether a table exists.
PostgreSQL DESCRIBE TABLE Equivalent
Some DBMSs such as Oracle, MySQL, and MariaDB have a DESCRIBE command that returns information about tables and views. It goes DESCRIBE table where table is the name of the table or view, and it can also be followed by a column name if you only want information about a specific column.
PostgreSQL doesn’t have a DESCRIBE TABLE command as such, but there are alternatives.
DROP TABLE IF EXISTS in SQLite
In SQLite, we can use the IF EXISTS clause of the DROP TABLE statement to check whether the table exists or not before dropping it.
PRAGMA table_list in SQLite
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).