● videoINMS Data Import
Concept: Constraints

Free for everyone
This video is free for everyone
Watch the whole thing, no account needed. If it clicks, grab PostgreSQL Fundamentals for lifetime access to every lesson.
SECTION
INMS Data Import
NEXT UP
Transformation, Part 2
COURSE
PostgreSQL Fundamentals
28 lessons
About this lesson
We have a number of constraints on our table and we really should understand what they do at a deeper level. In this video we'll dive into the constraint code below.
create table inms(
id bigserial primary key,
created_at timestamp not null,
altitude numeric(9,2) not null check(altitude > 0),
source text not null check(source in('osi','csn','osnb','osnt'))
mass numeric(6,3) not null check(mass >=0.125 and mass < 100),
high_sensitivity_count int not null check(high_sensitivity_count > 0),
low_sensitivity_count int not null check(low_sensitivity_count > 0)
);