1

I know how to use queries but I've never had to use one for this particular tasks .. I know about the SHOW TABLES; command .. How can I write a query to check if a particular table exists in a MYSQL database .. For example , a query that checks if table MEMBERS exists in database called USERS ??

2 Answers 2

2

You can use INFORMATION_SCHEMA.TABLES

USE USERS;
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'MEMBERS'
Sign up to request clarification or add additional context in comments.

Comments

2

Searching Table:

select * from information_schema.tables where table_name like '%MEMBERS%'

Searching Column:

select * from information_schema.columns where table_name like '%COLUMN%'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.