MySQL·Practice drills 4

Drill 10: Why this way — Setup and tools

Explain why the example is written this way rather than another way.

Beginner 5 min read Lesson 101 of 300 Challenge included
What you will be able to do
  • Explain why the example is written this way rather than another way.

Practice task

Explain why the example is written this way rather than another way.

setup.sqlSQL
CREATE DATABASE edubyte CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
USE edubyte;

CREATE TABLE lessons (
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  course_slug VARCHAR(80) NOT NULL,
  title VARCHAR(160) NOT NULL,
  minutes SMALLINT UNSIGNED NOT NULL DEFAULT 10,
  INDEX lessons_course_idx (course_slug)
);

INSERT INTO lessons (course_slug, title, minutes) VALUES ('css', 'Grid', 18);
Your turn

Write your answer

Easy

Explain why the example is written this way rather than another way.

TEXT · starter
Your answer…
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Lesson 101 of 300 · 0% of course