Creating table if not already exists
The CREATE TABLE has one clause that we can add to create table if it doesn’t exist already. So this comes handy if you already have created a table and instead of throwing an error it simply gracefully handles the query and doesn’t re-create the table.
Let’s first creat a table, as usual, we’ll use the goodol users table.
CREATE TABLE users (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL
);
Let’s insert some data into the table.