Preparing for Tutorial

Create the myapp database and Users Table

CREATE DATABASE myapp;

CREATE TABLE users (
    USER_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    first_name VARCHAR(55),
    fav_color VARCHAR(20),
    has_pets TINYINT
);

Insert the Users into the Table

INSERT INTO users
(USER_ID, first_name, fav_color, has_pets)
VALUES
(NULL, "FRANK", "blue", 6),
(NULL, "Jorina", "yellow", 2),
(NULL, "Emma", "pink", 4),
(NULL, "Ben", "red", 1),
(NULL, "Amber", "gray", 0),
(NULL, "Jackie", NULL, 2),
(NULL, "Wendy", "hotpink", 3),
(NULL, "Henry", NULL, 4),
(NULL, "Olivia", "orange", 2),
(NULL, "Abraham", "neon pink", 4)

Duplicating a table & Inserting data:

CREATE TABLE users_backup LIKE users;  // creates users_backup with same structure as users.

INSERT INTO users_backup SELECT * FROM users;