Created
January 31, 2016 03:57
-
-
Save RafaAguilar/7986a1a8755ed21609ee to your computer and use it in GitHub Desktop.
Obtain _not null_ and with no _default value_ fields of a table (useful when you need an _INSERT_ test statement of a big table)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
COLUMN_NAME AS `Field` | |
FROM | |
information_schema.COLUMNS | |
WHERE | |
TABLE_SCHEMA = 'schemaName' | |
AND TABLE_NAME = 'tableName' | |
AND IS_NULLABLE = 'NO' | |
AND (COLUMN_DEFAULT IS NULL | |
OR COLUMN_DEFAULT = '') | |
LIMIT 200; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment