Advertisement
Guest User

Trips CHECK

a guest
Feb 11th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.40 KB | None | 0 0
  1. CREATE TABLE Trips
  2. (
  3.     Id INT PRIMARY KEY IDENTITY,
  4.     RoomId INT NOT NULL
  5.         CONSTRAINT FK_Trips_Rooms FOREIGN KEY (RoomId) REFERENCES Rooms(Id),
  6.     BookDate DATETIME NOT NULL,
  7.     ArrivalDate DATETIME NOT NULL,
  8.     ReturnDate DATETIME NOT NULL,
  9.     CancelDate DATETIME,
  10.  
  11.     CONSTRAINT CHK_IfBeforeArrivalDate CHECK(BookDate < ArrivalDate),
  12.     CONSTRAINT CHK_IfBeforeReturnDate CHECK(ArrivalDate < ReturnDate),
  13. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement