Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone tell me how to check if the table exists in SQL?

1 Answer

0 votes
by (119k points)

Here is the SQL query to check if the Employee table exists in SQL server:

IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'Employee')

BEGIN

    PRINT 'Table Exists'

END

In MySQL, there is a simple query to check if the Employee table exists:

SHOW TABLES LIKE '%Employee%';

If you want to learn SQL from Industry experts then check out this SQL course by Intellipaat that provides Instructor-led training, hands-on experience, and certification.

Related questions

0 votes
1 answer
0 votes
1 answer
+2 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 18, 2019 in SQL by Tech4ever (20.3k points)

Browse Categories

...