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');