Skip to content
CampusEduX

Create a disposable database with explicit text defaults

Easysql
Learn the Concept: CREATE DATABASE

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.

sql
CREATE 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.

Related Problems

Input (stdin)

Output

Run your code to see output here...