Basic Course

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.

4.68 ★★★★★ ★★★★★ (635 ratings)

6,973 learners enrolled

Lifetime access

limited to this course only

$39

Want a better deal?

Get unlimited lifetime access to all 75 present and future courses

Save $450

Unlimited lifetime access

to all 75 present and future courses

$149 $599

75% OFF

Free trial Yes

Certificate of completion Yes

Time to complete 10 h

Coding challenges 89

Skills you will gain

  • 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.

Last reviews

Description

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.

Cover image for the course 'Data Types in SQL'

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

Course progress 0%

Exercises completed 0/89

  1. Text data types

    0/15

    Learn about the text data types to store names, titles, descriptions, or notes in your database.

  2. Numerical data types

    0/18

    Master numeric data types in SQL. Learn about the caveats of mathematical operators in your database. Learn how to choose the right numerical data type for your data.

  3. Identity columns and sequences

    0/17

    Learn how a database can auto-generate primary keys and other values.

  4. Boolean, Date, and Time data types

    0/14

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

  5. Modifying column data types

    0/17

    How and when to change the data type of an existing column in a database.

  6. Final Quiz

    0/8

    Time to test your knowledge!

Get the Certificate of Competency in SQL

This certificate will confirm your practical SQL problem-solving skills

Reviews (0)

Average rating

4.68/5

★★★★★ ★★★★★ (635 ratings)

5 stars

69%

4 stars

31%

3 stars

0%

2 stars

0%

1 stars

0%