DX実践講座 SQL文

DX実践講座SQL文

テーブル作成

CREATE TABLE t_temp01 ( id int(11) auto_increment NOT NULL COMMENT ‘ID’ , temp_date date NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘取得日’ , temp_time time NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘取得時間’ , temp_place_id int(5) NOT NULL COMMENT ‘場所コード’ , temp_temp float NOT NULL COMMENT ‘温度’ , create_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT ‘登録日時’ , update_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘更新日時’ , PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4;

テーブル削除

DROP TABLE t_temp01;

データインサート

INSERT INTO t_temp01( temp_place_id, temp_temp ) VALUES( ’10’, {{payload}} );

データ確認

SELECT * FROM t_temp01;