Sample questions
Mysql Types ConstraintsDifficulty 1
With MySQL 8.0's standard default_storage_engine setting, which storage engine does CREATE TABLE use when ENGINE is omitted?
- aInnoDB✓
- bMyISAM
- cMEMORY
- dARCHIVE
Explanation:The standard default_storage_engine setting in MySQL 8.0 is InnoDB. The setting is configurable at server or session level, however, so omitting ENGINE uses whatever engine that variable currently names; explicitly specifying ENGINE=... also overrides the default for that table.
Mysql Types ConstraintsDifficulty 1
Which of the following is a core advantage of the InnoDB storage engine over MyISAM?
- aIt always uses less disk space for the same data
- bSupports foreign keys and transactions (COMMIT/ROLLBACK)✓
- cIt is the only engine that supports fulltext indexes
- dIt never needs any locking mechanism
Explanation:InnoDB's defining features versus MyISAM are transaction support (COMMIT/ROLLBACK, crash recovery via redo/undo logs) and foreign key enforcement. Fulltext indexing is not InnoDB-exclusive — MyISAM supported it earlier, and InnoDB gained it in 5.6. Every engine needs some form of locking to guarantee correctness.
Mysql Types ConstraintsDifficulty 1
Which integer type uses the least amount of disk space in MySQL?
- aINT
- bSMALLINT
- cTINYINT✓
- dMEDIUMINT
Explanation:TINYINT uses 1 byte (range -128..127, or 0..255 unsigned), SMALLINT uses 2 bytes, MEDIUMINT uses 3 bytes, and INT uses 4 bytes. TINYINT is the smallest of the standard MySQL integer types.
Mysql Types ConstraintsDifficulty 1
Which data type should be preferred for values requiring exact decimal precision, such as monetary amounts?
- aFLOAT
- bDOUBLE
- cINT
- dDECIMAL✓
Explanation:DECIMAL stores exact fixed-point values as a packed binary representation of the digits, so arithmetic on it doesn't suffer the rounding error inherent to binary floating point. FLOAT/DOUBLE are IEEE 754 binary approximations and are not safe for money; INT can't represent fractional amounts at all.
Mysql Types ConstraintsDifficulty 1
In a VARCHAR(n) column definition, what does n represent?
- aThe maximum number of characters that can be stored✓
- bA fixed number of bytes always reserved for the value
- cThe number of bytes used by the column's charset
- dThe maximum length allowed for an index on the column
Explanation:n in VARCHAR(n) is a character-count limit, not a byte count — the actual bytes used depend on the column's charset (e.g. up to 4 bytes/char for utf8mb4) and on how long the stored value actually is, since VARCHAR is variable-length with a length prefix.
Mysql Types ConstraintsDifficulty 1
Which MySQL charset should be used to correctly store 4-byte UTF-8 characters like emoji?
- autf8
- butf8mb4✓
- clatin1
- dascii
Explanation:MySQL's utf8 (an alias for utf8mb3) only stores up to 3 bytes per character and cannot represent full 4-byte UTF-8 code points such as most emoji. utf8mb4 supports the full Unicode range, up to 4 bytes per character, and is the correct choice for emoji or full Unicode support.