Showing posts with label FAQ. Show all posts
Showing posts with label FAQ. Show all posts

Thursday, 30 August 2012

How to find table exist or not in SQL?

How to find table exist or not in SQL?

Select name FROM sqlite_master WHERE name=’table_name’;

A variation would be to use SELECT COUNT(*) instead of SELECT NAME, i.e.
SELECT count(*) FROM sqlite_master WHERE type=’table’ AND name=’table_name’;
SELECT name FROM sqlite_master  WHERE type=’table’ ORDER BY name;