How I can define this constraint?
问题 I am designing a database for a parking lot in Postgres. I need to define a constraint (or similar) to verify the Id_Lot in Ticket is empty in the table "Lot" . How I can do it? The relevant tables are: Ticket: "Id_Ticket" serial PRIMARY KEY, "Date_Entrance" date NOT NULL, "Time_Entrance" time without time zone NOT NULL, "License_plate" varchar(6) NOT NULL references "Vehicle"("L_Plate"), "Id_Lot" varchar(4) NOT NULL references "Lot"("Code") Lot: "Code" varchar(4) NOT NULL PRIMARY KEY, "Type"