Introduction
Boolean
Date and time
Summary
42. Summary - Exercise 3

Instruction

You did a good job! Are you ready for the final challenge?

Exercise

After many months, Peter finally decided it was time to reconstruct his table with user_account. Read the description below, suggest the appropriate data types and build the SQL instruction.

Now each user has a user_id which is a combination of letters and digits, always 8 characters long (like X87DEW45).

We need to store information about the first_name and last_name, each of which can be up to 40 characters long.

Next, there is a nickname, which can be 20 characters long. Each user has their birthday on a specific day. They also provide their description, which can be of any length, weight and height which are no greater than 300 and have one digit after the decimal. Finally, we need to store information about tattoos (name the column has_tattoos) - a simple yes or no will do.

Stuck? Here's a hint!

Type

CREATE TABLE user_account (
    user_id char(8),
    first_name varchar(40),
    last_name varchar(40),
    nickname varchar(20),
    birthday date,
    description text,
    weight decimal(4,1),
    height decimal(4,1),
    has_tattoos boolean
);

Console

Code editor

Result

TableConsole