SQLite - Checking whether a table exists

How to check if a table already exists in SQLite?

Run this query to check:

SELECT name FROM sqlite_master WHERE type='table' AND name='table_name';

Before creating or dropping a table, use IF EXISTS when you're not sure:

  • To create a table:
CREATE TABLE IF NOT EXISTS table_name (table_definition);
  • To drop a table:
DROP TABLE IF EXISTS table_name;

TablePlus is a native graphical client for SQLite. A free version is available.

Download TablePlus for Mac.

Not on Mac? Download TablePlus for Windows.

On Linux? Download TablePlus for Linux

Need a quick edit on the go? Download TablePlus for iOS

TablePlus GUI Tool SQLite

← All posts