| Goal | Find cases where optional columns are before a mandatory column. Place mandatory columns before optional columns to improve comprehensibility of the table. |
|---|---|
| Notes | M denotes a mandatory column and O an optional column. Columns are sorted based on the ordinal position. |
| Type | Problem detection Each row in the result could represent a flaw in the design |
| Reliability | Low Many false-positive results |
| License | MIT (opens in new tab) |
| Data Source | INFORMATION_SCHEMA only |
| SQL Query |
|
Fixing Suggestion
Changing the order of columns in an existing table that is already in use requires dropping and re-creating the table and loading data to the new table. Probably this is not worth the trouble. Change the order only in case of newly create tables.
Categories
This query is classified under the following categories:
Comfortability of database evolution
Queries of this category provide information about the means that influence database evolution.
Missing data
Queries of this category provide information about missing data (NULLs) in a database.
| Name | Description |
|---|---|
| Comfortability of database evolution | Queries of this category provide information about the means that influence database evolution. |
| Missing data | Queries of this category provide information about missing data (NULLs) in a database. |
Further reading and related materials: