docker exec -it container_name bash
mysql -u [사용자이름] -p -h [로컬 MySQL 호스트] -P [로컬 MySQL 포트]
CREATE DATABASE 스키마명;
USE 스키마명;
모비우스 DB -> 그림 하단의 4개의 테이블
CREATE TABLE M_AquafarmInfo (
aquafarm_ID INT NOT NULL PRIMARY KEY,
aquafarm_Name VARCHAR(255) NULL
);
CREATE TABLE M_TankInfo (
fish_tank_ID INT NOT NULL,
tank_num INT NULL,
fish VARCHAR(10) NULL,
aquafarm_ID INT NOT NULL,
PRIMARY KEY (fish_tank_ID),
FOREIGN KEY (aquafarm_ID) REFERENCES M_AquafarmInfo (aquafarm_ID)
);
CREATE TABLE M_DeviceInfo (
device_ID INT NOT NULL,
device_name VARCHAR(10) NULL,
fish_tank_ID INT NOT NULL,
PRIMARY KEY (device_ID),
FOREIGN KEY (fish_tank_ID) REFERENCES M_TankInfo (fish_tank_ID)
);
CREATE TABLE M_WaterInfo (
water_ID INT NOT NULL,
device_ID INT NOT NULL,
water_temp DECIMAL(4,2) NULL,
do DECIMAL(4,2) NULL,
turbi DECIMAL(5,2) NULL,
nh4 DECIMAL(5,2) NULL,
pH DECIMAL(3,2) NULL,
alcohol DECIMAL(4,2) NULL,
salt DECIMAL(4,2) NULL,
PRIMARY KEY (water_ID),
FOREIGN KEY (device_ID) REFERENCES M_DeviceInfo (device_ID)
);
SHOW FULL TABLES FROM 스키마명