zkt25/z2/sensors_db.sql

22 lines
1.2 KiB
SQL
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE DATABASE sensors_db;
USE sensors_db;
CREATE TABLE sensors (
id INT AUTO_INCREMENT PRIMARY KEY,
x INT NOT NULL,
y INT NOT NULL,
floor INT NOT NULL DEFAULT 1,
location VARCHAR(255) NOT NULL,
value VARCHAR(50) NOT NULL
);
-- Insert sample sensor data with floor information
INSERT INTO sensors (x, y, floor, location, value)
VALUES
(100, 100, 1, 'Room A', '22°C'),
(200, 200, 1, 'Room B', '24°C'),
(150, 150, 2, 'Living Room', '23°C'),
(250, 250, 2, 'Kitchen', '21°C'),
(120, 120, 3, 'Hallway', '22°C'),
(220, 220, 3, 'Bathroom', '23°C');