Our website uses cookies. By using this website, you agree to their use in accordance with the browser settings. You can modify your browser settings on your own. For more information see our Privacy Policy.



Data Types in SQL

Choose the right type of data for your needs. A data type tells the database what kind of information a column will store. Learn about common data types in SQL Server, MySQL, Oracle, and PostgreSQL.

Table of contents

Lifetime access


limited to this course only


Buy now

Want a better deal?


Get unlimited lifetime access to all 71 present and future courses

Save $440

Unlimited lifetime access


to all 71 present and future courses



73% OFF

Buy now

Interactive exercises

10 h

Estimated time


Users enrolled


635 ratings

Welcome to Data Types in SQL! This is the second course in the Creating Database Structure track. We assume that you already know how to create a table in SQL. If not, take The Basics of Creating Tables in SQL before you start this course.

Data types are extremely important. A data type tells the database the kind of information (number, text, date, etc.) each column will store. It influences the functions and operations you can do on a column, how much space the column will take, how the database stores the data internally, and so on.

In this course, we will discuss the most basic data types and the primary differences between them. After you complete the exercises, you’ll know how to select the right data type for whatever information you want to store.

This interactive tutorial is based on standard SQL. But don't worry. The data types shown here will work in all popular relational database management systems, including SQL Server, MySQL, Oracle, and PostgreSQL.

Are you a beginning IT professional, computer science student, or database administrator (DBA)? Do you work as a programmer or developer? If you need to understand or work with data types in a relational database, this is the perfect course for you.

In Data Types in SQL, we discuss:

  • Text data types that can store short texts of variable length (VARCHAR) and predefined length (CHAR). We also talk about data types that store text files (TEXT, CLOB).
  • Numerical data types and the differences between integer types (INTEGER), floating point numbers (DOUBLE PRECISION), and decimal numbers (DECIMAL).
  • Identity columns and sequences, which auto-generate values and primary key identifiers (GENERATED ALWAYS BY DEFAULT, GENERATED ALWAYS BY DEFAULT AS IDENTITY).
  • Boolean and date/time data types, which are used to store true and false values (BOOLEAN) or date and time data (DATE, TIME, TIMESTAMP).
  • How to modify a column’s data type, e.g. when can you alter a column’s defined data type and what happens to the data when you do.

This course is interactive. You’ll learn how to work with different data types by writing real SQL commands and solving exercises directly in your web browser. Our platform runs your command and verifies your solution. You don’t need to install any software.

What Do You Need to Take This Course?

  • A web browser and an internet connection.
  • Knowledge of SQL, including SELECT, INSERT, UPDATE, and DELETE.
  • Basic understanding of the CREATE TABLE syntax.

This Course Will Teach You How To:

  • Choose the right data type for different columns.
  • Auto-generate column values with GENERATED ALWAYS.
  • Create a sequence.
  • Use sequences to auto-generate values.
  • How to alter tables and change column data types.

Who Should Take This Course?

  • Beginning developers and programmers
  • Beginning database administrators (DBAs)
  • Students taking classes in relational databases
  • Anyone who wants to understand the data types used in relational databases

Table of contents


Paid content


Course progress


Exercises completed


Boolean, Date, and Time data types

How to store true/false information, and date and time information in your database.



Final Quiz

Time to test your knowledge!


Reviews (0)

Average rating



635 ratings


5 stars


4 stars


3 stars


2 stars


1 stars