Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Your first table
Text data types
Summary

Instruction

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

The basic data type for text information is varchar. This data type always requires an explicit length, in characters, of the text which it's going to store. We put the length in brackets, i.e., varchar(length). For instance, the following statement ...

CREATE TABLE user_account (
  first_name varchar(32)
);

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

Please note that if you use Oracle as your database, this 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. The table name is user_account and it has two columns: nickname and first_name. Both of them are varchar types, and both are 32 characters long.