Skip to content

uploaded the data integrity questions#223

Open
ChenEylon wants to merge 10 commits into
evidencebp:mainfrom
ChenEylon:main
Open

uploaded the data integrity questions#223
ChenEylon wants to merge 10 commits into
evidencebp:mainfrom
ChenEylon:main

Conversation

@ChenEylon

Copy link
Copy Markdown
Contributor

No description provided.

@ChenEylon ChenEylon closed this Jun 15, 2026
@ChenEylon ChenEylon reopened this 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,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find any of the commits on Github.
Where did they come from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants