Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Text information
Boolean
Date and time
Summary

Instruction

Alright! Now that you know a bit about text information, let's discuss the data types to represent them.

The basic data type for text information is varchar. The varchar data type always requires the length of the text which it's going to store. We put the length in brackets after the word varchar. For instance, the following statement:

CREATE TABLE user_account (first_name varchar(32));

will create a table with a single column first_name whose data type is varchar(32). This means that any value in this column must be 32 characters long or shorter.

Please note that if you ever use Oracle as your database, the data type is called varchar2 instead of varchar.

Exercise

Now that you know the varchar data type, try to create Peter's table on your own. Its name is user_account and it has two columns: nickname and first_name. Both of them are varchar types, 32 characters long.

Stuck? Here's a hint!

Type

CREATE TABLE user_account (
    first_name varchar(32),
    nickname varchar(32)
);