Skip to content

Instantly share code, notes, and snippets.

@jonpemby
Last active March 15, 2018 18:22
Show Gist options
  • Save jonpemby/687cf739124212195bbfc95308dceb67 to your computer and use it in GitHub Desktop.
Save jonpemby/687cf739124212195bbfc95308dceb67 to your computer and use it in GitHub Desktop.
MySQL find all required columns from table
select * from information_schema.COLUMNS
where TABLE_SCHEMA = 'schema'
and TABLE_NAME = 'table' -- optionally specify the table
and IS_NULLABLE = 'NO' -- optionally set to 'YES' to find nullable columns
and COLUMN_DEFAULT is null; -- optionally specify columns without a default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment