User-defined data types
ENUM or enumerated data types are great options to use in your database when you have a column where you want to store a fixed list of values that rarely change. Examples of when it would be appropriate to use an ENUM include days of the week and states or provinces in a country.
Another example can be the directions on a compass (i.e., north, south, east and west.) In this exercise, you are going to create a new ENUM data type called compass_position.
Latihan ini adalah bagian dari kursus
Functions for Manipulating Data in PostgreSQL
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
-- Create an enumerated data type, compass_position
___ ___ ___ AS ___ (
-- Use the four cardinal directions
'___',
'___',
'___',
'___'
);