Introduction to PostgreSQL data types

Creating PostgreSQL Databases

Darryl Reeves

Industry Assistant Professor, New York University

Data categories in PostgreSQL

  • Text
  • Numeric
  • Temporal
  • Boolean
  • Others: Geometric, Binary, Monetary
Creating PostgreSQL Databases

Example 1: representing birthdays

  • Cathy: May 3rd, 2006
  • Possible representations
    • "May 3, 2006" (text)
    • "5/3/2006" (text)
    • 2006-05-03 (date)
Creating PostgreSQL Databases

Example 2: tracking payment status

  • Did attending member pay?
  • Possible representations:
    • "Yes"/"No" (text)
    • "Y"/"N" (text)
    • 'true'/'false' (boolean)
  • Specific types provide restriction on values
Creating PostgreSQL Databases

Example 3: trip distances

  • Mark flew 326 miles for client meeting
  • Possible representations:
    • "326 miles" (text)
    • "326" (text)
    • 326 (numeric)
Creating PostgreSQL Databases

Let's practice!

Creating PostgreSQL Databases

Preparing Video For Download...