Advertisement
ZvonimirAnic

Untitled

Feb 27th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. CREATE TABLE Device
  2. (
  3. DeviceId bigint IDENTITY(1,1) CONSTRAINT PK_Device PRIMARY KEY,
  4. Name nvarchar(100) NOT NULL
  5. )
  6. CREATE TABLE Measurement
  7. (
  8. MeasurementId bigint IDENTITY(1,1) CONSTRAINT PK_Measurement PRIMARY KEY,
  9. DeviceId bigint CONSTRAINT FK_Measurement_Device FOREIGN KEY(DeviceId)
  10. REFERENCES dbo.Device (DeviceId) NOT NULL,
  11. Temperature decimal(18, 2) NOT NULL,
  12. Humidity decimal(18, 2) NOT NULL,
  13. CreatedOn datetime NOT NULL
  14. )
  15. GO
  16. INSERT INTO Device (Name) VALUES ('My only device')
  17. GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement