Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Your first table
CREATE TABLE basics
9. The VARCHAR column type
Entity Relationship Diagrams (ERD)
DROP - how to remove a table

Instruction

Nice! Let's add another column to our example - this time not a number:

CREATE TABLE airplane (
   id int,
   max_passengers int,
   model varchar(32)
);

As you can see, we put varchar(32) instead of int for the column model. The data type varchar is a column type used to store text values. In the parentheses, you should specify the maximum length of any value in that column (32 stands for 32 characters). Try to keep it as small as possible - the greater the value, the more space the database will require!

Please note that Oracle database uses varchar2 where other database use varchar.

Exercise

Create a table named result with the following three columns:

  • id - a number,
  • name - a text of 32 characters at most, and
  • score - a number again.

Stuck? Here's a hint!

Type

CREATE TABLE result (
    id int,
    name varchar(32),
    score int
);