We've been moving along at a pretty fast clip and it's crucial that we don't go too fast, skimming over super important concepts like constraints!


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)
);