Setup and tools
Connect with the MySQL client and learn the shape of a database.
What you will be able to do
- Use utf8mb4 for text columns.
- Create a dedicated user rather than using root.
- Inspect schema with SHOW TABLES and DESCRIBE.
- Use the mysql client or a GUI such as TablePlus.
In plain English
MySQL stores tables inside a database. Start by creating a database, a user and a table, then insert and select. Use utf8mb4 so emoji and every language are stored correctly.
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
EasyCreate a courses table
Create a courses table with an id, a unique slug and a title.
SQL · starter
CREATE TABLE courses (Check your understanding before moving on.
Knowledge checkQuestion 1
Which character set should you use for modern text?
Select an answer to continue
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 inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.