uploaded the data integrity questions#223
Open
ChenEylon wants to merge 10 commits into
Open
Conversation
evidencebp
requested changes
Jun 15, 2026
| @@ -0,0 +1,3 @@ | |||
| Number,Question,What was the problem type?,What was the problem?,How would you fix it?,Answer,Commit,Comment | |||
| 1,"When executing a database migration script to drop constraints, a developer encounters MySQL error 150 while trying to drop a Unique Key (UK) constraint before dropping a Foreign Key (FK) constraint that references the same column. How should the execution order of the DROP operations be structured to avoid this error?",Data Integrity,"In MySQL, you cannot drop or alter a Unique Key or Primary Key constraint if there is an active Foreign Key constraint in another table (or the same table) that relies on it. Attempting to do so breaks referential integrity mid-operation, resulting in Error 150.","To resolve this issue, the drop order must be reversed: first, execute the statement to drop the Foreign Key constraint (ACT_FK_EXE_PROCDEF), and only after it is successfully removed, execute the statement to drop the Unique Key constraint (ACT_UNIQ_RU_BUS_KEY).",The developer must alter the migration sequence to ensure all dependent Foreign Key (FK) constraints are dropped prior to removing the core Unique Key (UK) or Primary Key constraint.,bf8f10d51cdb55c0b6fce5bcfac98a5f014cd75d, | |||
Owner
There was a problem hiding this comment.
Your questions are interesting yet they should be of a specific type, as in the examples.
The question is a query with a problem.
The answer is the fixed query.
| @@ -0,0 +1,3 @@ | |||
| Number,Question,What was the problem type?,What was the problem?,How would you fix it?,Answer,Commit,Comment | |||
| 1,"When executing a database migration script to drop constraints, a developer encounters MySQL error 150 while trying to drop a Unique Key (UK) constraint before dropping a Foreign Key (FK) constraint that references the same column. How should the execution order of the DROP operations be structured to avoid this error?",Data Integrity,"In MySQL, you cannot drop or alter a Unique Key or Primary Key constraint if there is an active Foreign Key constraint in another table (or the same table) that relies on it. Attempting to do so breaks referential integrity mid-operation, resulting in Error 150.","To resolve this issue, the drop order must be reversed: first, execute the statement to drop the Foreign Key constraint (ACT_FK_EXE_PROCDEF), and only after it is successfully removed, execute the statement to drop the Unique Key constraint (ACT_UNIQ_RU_BUS_KEY).",The developer must alter the migration sequence to ensure all dependent Foreign Key (FK) constraints are dropped prior to removing the core Unique Key (UK) or Primary Key constraint.,bf8f10d51cdb55c0b6fce5bcfac98a5f014cd75d, | |||
| 2,"When running a database in MySQL Strict Mode, a schema definition script fails with Warning 1101: BLOB/TEXT column 'abcdef' can't have a default value. Why does this error occur, and what is the best approach to rectify the column definition if the application logic never passes implicit nulls to this column?",Data Types Restrictions,"MySQL in Strict Mode strictly enforces the rule that large object data types, specifically BLOB and TEXT, cannot be assigned a default value directly within the table creation or modification statement. The original schema tried to declare a default string/value for a text-based column, violating this engine constraint.","Since the application logic handles data initialization and ensures that empty or null values are never passed directly to this field, the explicit DEFAULT assignment can be safely removed from the SQL schema definition entirely.","Omit the DEFAULT clause from the TEXT or BLOB column definition in the SQL statement, allowing the application layer to manage the default state of the data during insert operations.",92f9e48d63574e1f890493d085488667299782b4, No newline at end of file | |||
Owner
There was a problem hiding this comment.
I could not find any of the commits on Github.
Where did they come from?
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.