1

I know how to check for the existence of a column using the syntax SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = "my_table" AND COLUMN_NAME = "my_column"

Is there a way to check for the existence of a column when the DB user doesn't have access to the information_schema? Or would you just do something like try a SELECT from that column and if you get an error then you know that the column doesn't exist?

1 Answer 1

1

Good old SHOW COLUMNS FROM table_name:

Sign up to request clarification or add additional context in comments.

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.