...

/

Exercise: Schema and Object Management

Exercise: Schema and Object Management

Practice and test your understanding of schema and object management.

Now, let’s get some hands-on practice.

Question 1

Write an SQL command to create a database named GlobalApp specifically using the utf8mb4 character set and the utf8mb4_0900_ai_ci collation (a common modern default that is accent-insensitive and case-insensitive).

Press + to interact
MySQL 8.0
-- Create GlobalApp with specified character set and collation

If you’re stuck, click the “Show Solution” button.

Question 2

Given the following structure of the Customers table:

Field

Type

CustomerID

int

CustomerName

varchar(50)

Email

varchar(50)

Phone

varchar(15)

Address

varchar(100)

LastLogin

date

CreatedAt

timestamp

CustomerTier

enum('New','Regular','VIP')

ReferralID

int

LoyaltyPoints

int

LastPurchaseDate

date

IsChurnRisk

boolean

Where CustomerID is the primary key and ReferralID is self-referencing to CustomerID. The table contains information about customers.

Also, we have the following structure of the Products table:

Field

Type

ProductID

int

ProductName

varchar(50)

CategoryID

int

Price

decimal(10,2)

Stock

int

LastRestockDate

date

MonthlySales

int

InventoryTurnoverRate

decimal(5,2)

Where ProductID is the primary key and CategoryID is the foreign key from the Categories table. The table contains information about products.

Create a table named ProductReviews to store customer reviews for products. It should include:

  1. ReviewID (INT, ...