2024-06-27 10:41:32 +02:00
|
|
|
CREATE DATABASE arduino;
|
2024-06-27 10:38:58 +02:00
|
|
|
USE arduino;
|
|
|
|
|
|
|
|
CREATE TABLE sensoren (
|
|
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
bezeichnung varchar(256)
|
|
|
|
);
|
|
|
|
|
2024-06-27 10:41:32 +02:00
|
|
|
INSERT INTO sensoren (id, bezeichnung) VALUES (1, "Decke");
|
|
|
|
INSERT INTO sensoren (id, bezeichnung) VALUES (2, "Heck");
|
|
|
|
INSERT INTO sensoren (id, bezeichnung) VALUES (3, "Front");
|
2024-06-27 10:38:58 +02:00
|
|
|
|
|
|
|
CREATE TABLE sensordaten (
|
|
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
temperatur FLOAT,
|
|
|
|
sensor_id INT,
|
|
|
|
FOREIGN KEY (sensor_id) REFERENCES sensoren(id)
|
|
|
|
);
|