Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE Device
- (
- DeviceId bigint IDENTITY(1,1) CONSTRAINT PK_Device PRIMARY KEY,
- Name nvarchar(100) NOT NULL
- )
- CREATE TABLE Measurement
- (
- MeasurementId bigint IDENTITY(1,1) CONSTRAINT PK_Measurement PRIMARY KEY,
- DeviceId bigint CONSTRAINT FK_Measurement_Device FOREIGN KEY(DeviceId)
- REFERENCES dbo.Device (DeviceId) NOT NULL,
- Temperature decimal(18, 2) NOT NULL,
- Humidity decimal(18, 2) NOT NULL,
- CreatedOn datetime NOT NULL
- )
- GO
- INSERT INTO Device (Name) VALUES ('My only device')
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement