Create a disposable database with explicit text defaults
In an authorized administrative lab, create database cxdbmslabcatalog if absent, with utf8mb4 and utf8mb4unicodeci defaults. Create TEMPORARY table cxdbmslabcatalog.copiedlabels(label VARCHAR(40) NOT NULL), copy labels from supplied lablabels, and return databasename, charactersetname, collationname and label_count. The database is initially absent or already has those exact defaults. Do not execute this against application databases.
MySQL dialect.
sqlCREATE TABLE lab_labels (label VARCHAR(40) NOT NULL); INSERT INTO lab_labels VALUES ('Science'),('Arts');
Required ordering: Exactly one catalog row for the stated database.
Edge cases:
- Empty labels still creates the requested structure.
- Repeated input labels count as separate occurrences.
INSERT INTO lab_labels VALUES ('Science'),('Arts');database_name character_set_name collation_name label_count cx_dbms_lab_catalog utf8mb4 utf8mb4_unicode_ci 2
Explanation: Database defaults and qualified table placement are explicit; catalog output and copied count expose the resulting definition and state.
- Requires CREATE DATABASE in an isolated administrative lab; restricted query runners may not support it.
- Only cx_dbms_lab_catalog is the creation target.
Hint 1
Create the database with explicit defaults before the qualified temporary table.
Hint 2
Inspect INFORMATION_SCHEMA.SCHEMATA for the named target.
Database defaults and qualified table placement are explicit; catalog output and copied count expose the resulting definition and state.
Database defaults and qualified table placement are explicit; catalog output and copied count expose the resulting definition and state.
Related Problems
- Detect defaults drift after guarded database creationMedium · sqlSolve Problem
- Select one student occurrence by identityEasy · sqlSolve Problem
- List immediate lab childrenEasy · sqlSolve Problem