sql_create_and_inserts hinzugefügt
This commit is contained in:
parent
bc1a5b68ce
commit
bdedfcbba0
18
sql_create_and_inserts
Normal file
18
sql_create_and_inserts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
USE arduino;
|
||||||
|
|
||||||
|
CREATE TABLE sensoren (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
bezeichnung varchar(256)
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into sensoren (id, bezeichnung) VALUES (1, "Decke");
|
||||||
|
insert into sensoren (id, bezeichnung) VALUES (2, "Heck");
|
||||||
|
insert into sensoren (id, bezeichnung) VALUES (3, "Front");
|
||||||
|
|
||||||
|
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)
|
||||||
|
);
|
Loading…
Reference in a new issue