[{"id":"mysqladvanced-001","courseId":"mysql-advanced","domain":"schema-and-data-types","topic":"Row size limit","prompt":"A teammate creates an InnoDB table with six VARCHAR(10000) columns and one VARCHAR(6000) column, in latin1, and gets ERROR 1118: Row size too large. Which change lets the same data fit in one row?","hint":"Not every column type adds its full declared size to the row.","explain":"MySQL keeps a fixed internal ceiling on the size of one row, and that ceiling applies whatever the storage engine. Each column counts toward it according to how its data is stored.","source":"https://dev.mysql.com/doc/refman/8.4/en/column-count-limit.html","interaction":{"type":"single"},"options":[{"id":"a","text":"Change some of the columns to TEXT or BLOB","why":"TEXT and BLOB columns count only 9 to 12 bytes toward the row limit, because their contents are stored separately from the row."},{"id":"b","text":"Switch the table to MyISAM, which has no row size limit","whyNot":"The 65,535-byte row limit is enforced regardless of storage engine, so MyISAM hits it as well."},{"id":"c","text":"Raise innodb_page_size to 64KB to lift the row limit","whyNot":"A 64KB page raises InnoDB's local row capacity to about 16KB, but the 65,535-byte row limit still applies."},{"id":"d","text":"Change the character set to utf8mb4 to pack the text tighter","whyNot":"utf8mb4 can use up to four bytes per character, so VARCHAR columns grow rather than shrink."}],"answer":"a","explanation":"The internal row format caps a row at 65,535 bytes for every storage engine, and BLOB and TEXT columns count only 9 to 12 bytes toward that cap.","concept":"The internal row format caps a row at 65,535 bytes for every storage engine, and BLOB and TEXT columns count only 9 to 12 bytes toward that cap.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["The 65,535-byte row cap applies to every storage engine.","BLOB and TEXT columns count only 9 to 12 bytes toward the row cap."]},{"id":"mysqladvanced-002","courseId":"mysql-advanced","domain":"schema-and-data-types","topic":"Invisible columns and SELECT *","prompt":"In table t1, col2 is INVISIBLE. A teammate runs the statement below with no column definitions for t2. What is the visibility of col2 in t2?","hint":"Compare how CREATE TABLE ... SELECT treats the names it lists with the attributes those columns carry.","explain":"Invisible columns are hidden from queries such as SELECT *, but they can still be named explicitly. A create-table statement that copies data follows its own rules for which attributes survive.","source":"https://dev.mysql.com/doc/refman/8.4/en/invisible-columns.html","interaction":{"type":"single"},"options":[{"id":"a","text":"Invisible, because the attribute is copied with the column","whyNot":"CREATE TABLE ... SELECT does not carry invisibility over; only CREATE TABLE ... LIKE keeps it."},{"id":"b","text":"Visible, even though it was invisible in t1","why":"A column named explicitly in CREATE TABLE ... SELECT is created and comes out visible, unless the new table's own definition says INVISIBLE."},{"id":"c","text":"Missing from t2, because SELECT skips invisible columns","whyNot":"SELECT * skips invisible columns, but col2 is named in the select list, so it is included."},{"id":"d","text":"Visible, but empty, because invisible columns carry no data","whyNot":"The column is created from the SELECT list and receives its values; invisibility does not stop the data from being copied."}],"answer":"b","explanation":"CREATE TABLE ... SELECT does not keep a column's invisibility, even when the column is named explicitly, unless the new table's definition marks it INVISIBLE.","concept":"CREATE TABLE ... SELECT does not keep a column's invisibility, even when the column is named explicitly, unless the new table's definition marks it INVISIBLE.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"-- t1: col1 INT, col2 INT INVISIBLE\nCREATE TABLE t2 AS\n  SELECT col1, col2 FROM t1;","takeaways":["SELECT * skips invisible columns; naming them explicitly returns them.","CREATE TABLE ... SELECT drops invisibility unless you restate it."]},{"id":"mysqladvanced-003","courseId":"mysql-advanced","domain":"schema-and-data-types","topic":"SRID attribute on spatial columns","prompt":"A geometry column is declared with an SRID attribute. What does that attribute tell MySQL about the values stored in the column?","hint":"Think about what the numbers in a geometry value refer to.","explain":"Spatial columns hold geometry values, and a set of coordinates means little until you know what system measures them. Consider what the coordinates alone cannot tell you about a column's data.","source":"https://dev.mysql.com/doc/refman/8.4/en/creating-spatial-columns.html","interaction":{"type":"single"},"options":[{"id":"a","text":"The number of decimal places kept for each coordinate","whyNot":"SRID identifies a reference system; it does not set how many decimal places coordinates keep."},{"id":"b","text":"The spatial reference system that its values use","why":"The SRID attribute explicitly indicates the spatial reference system (SRS) for the values stored in the column."},{"id":"c","text":"A spatial index that MySQL builds on the column","whyNot":"SRID describes which coordinate system the values use; it does not create an index."},{"id":"d","text":"The format the column returns, such as GeoJSON","whyNot":"SRID names a reference system and does not choose an output format for the stored geometries."}],"answer":"b","explanation":"A spatial column's SRID attribute explicitly indicates the spatial reference system for the values stored in that column.","concept":"A spatial column's SRID attribute explicitly indicates the spatial reference system for the values stored in that column.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["SRID names the spatial reference system of a column's values.","Columns with a spatial data type can have an SRID attribute."]},{"id":"mysqladvanced-004","courseId":"mysql-advanced","domain":"schema-and-data-types","topic":"Multi-valued JSON array indexes","prompt":"A customers table has a JSON column custinfo, indexed with INDEX zips ((CAST(custinfo->'$.zipcode' AS UNSIGNED ARRAY))). One row's custinfo is {\"zipcode\": []}, an empty array. What does the index hold for that row?","hint":"Think about how many index entries a row should get when its array has nothing in it.","explain":"A normal index stores one entry for each row. An index can also be defined over an array held in a JSON column, so the number of entries for a row depends on what that array holds.","source":"https://dev.mysql.com/doc/refman/8.4/en/create-index.html","interaction":{"type":"single"},"options":[{"id":"a","text":"No index entries, so an index scan cannot reach that row","why":"A multi-valued key part with an empty array adds no entries, and the data record is then not reachable by an index scan."},{"id":"b","text":"One entry holding NULL","whyNot":"A NULL entry is made when the key part itself generates NULL; an empty array is not NULL, so no NULL entry appears."},{"id":"c","text":"One entry holding the number 0","whyNot":"The index holds the array's values, and an empty array has none, so no 0 value is invented."},{"id":"d","text":"An error, because the index cannot hold an empty array","whyNot":"An empty array is not an error for a multi-valued index; the row simply gets no entries."}],"answer":"a","explanation":"A multi-valued index is defined on CAST(... AS type ARRAY); a row whose array is empty gets no index entries, so an index scan cannot reach its data record.","concept":"A multi-valued index is defined on CAST(... AS type ARRAY); a row whose array is empty gets no index entries, so an index scan cannot reach its data record.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["An empty array adds no entries to a multi-valued index.","Multi-valued indexes are defined on CAST(... AS type ARRAY) expressions."]},{"id":"mysqladvanced-005","courseId":"mysql-advanced","domain":"schema-and-data-types","topic":"Atomic DDL","prompt":"In MySQL 8.4, after START TRANSACTION and an INSERT, a DDL statement that fails also rolls back that earlier INSERT.","hint":"Ask what a DDL statement does to a transaction that is already open.","explain":"A transaction groups statements so they commit or roll back together. Some statements interact with that grouping, and a statement's own atomicity is a separate matter from the transaction around it.","source":"https://dev.mysql.com/doc/refman/8.4/en/atomic-ddl.html","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"The DDL statement first ends the open transaction, as if a COMMIT ran, so the INSERT is already saved."},{"id":"b","text":"False","why":"Atomic DDL makes the DDL itself all-or-nothing, but the implicit commit has already made the INSERT permanent."}],"answer":"b","explanation":"DDL statements implicitly end any active transaction in the session, as if a COMMIT ran first, so a later DDL failure cannot undo earlier work.","concept":"DDL statements implicitly end any active transaction in the session, as if a COMMIT ran first, so a later DDL failure cannot undo earlier work.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["DDL implicitly commits an open transaction before it runs.","Atomic DDL covers one DDL statement, not the transaction around it."]}]