Creating Tables

In the previous lesson, you learned some of the basics of PostgreSQL by creating a table for storing user accounts from a CSV file. However, the table that you created used un-optimized datatypes for the type of data you were loading into it.

In this lesson, you are going to learn how to use the proper datatypes when loading our dataset. Correct use of datatypes will save space on the database server, which in turn provides faster reads and writes. Furthermore, having proper datatypes will ensure that any errors in your data will be caught at insertion and your data can be queried in the way you expect.

Additionally, you will discuss the datatypes that Postgres provides and some of their implementation details. Applying these skills as you learn, you will create a table that will fit a dataset with the proper dataypes. After you create the table, you will load in the data and ensure that the data model you selected was appropriate.

Knowing how to use proper datatypes when loading in a dataset is a critical skill for data engineers to learn. As you learn about selecting datatypes and creating tables, you’ll be able to apply what you’re learning directly in your browser window in our interactive coding environment, and get your work checked instantly by our answer-checker.


  • Learn how to modify table column data types in Postgres.
  • Learn about using proper datatypes for your data.

Lesson Outline

  1. Describing a Table
  2. Adding the id Field
  3. Finding the Max Length
  4. Max String-like Datatypes
  5. Creating the Other String Fields
  6. Float-like Types
  7. Boolean Types
  8. Date Type
  9. Next steps
  10. Takeaways

Get started for free

No credit card required.

Or With

By creating an account you agree to accept our terms of use and privacy policy.