How to get "not null column name" in mysql database?

Member

by denis , in category: MySQL , 7 months ago

How to get "not null column name" in mysql database?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by herminia_bruen , 5 months ago

@denis 

To get the column names that are not null in a MySQL database, you can execute the following query:

1
2
3
SELECT table_name, column_name
FROM information_schema.columns
WHERE table_schema = 'your_database_name' AND is_nullable = 'NO';


Replace 'your_database_name' with the name of your actual MySQL database. This query will retrieve a list of table names and their associated column names that have the constraint of not allowing NULL values.