0 votes
1 view
in SQL by (6.1k points)
I would like to create a table in an SQLite database only if the table doesn't exist already. Is there any way to like this? I don't want to drop the table if it exists already, only I need to create it if it doesn't.

1 Answer

0 votes
by (12.7k points)

You can use this following query for creating the table only if it doesn't exist.

CREATE TABLE IF NOT EXISTS some_table (id INTEGER PRIMARY KEY AUTOINCREMENT, ...);

Sign up for this Intellipaat's SQL Course now, to Learn SQL concepts in detail and get certified.

Related questions

0 votes
1 answer
asked Jul 26, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
0 votes
1 answer
asked Nov 21, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Oct 7, 2019 in SQL by Tech4ever (20.3k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...