0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

達人に学ぶSQL徹底指南書 2章 CREATE, INSERT文まとめ

Posted at

達人に学ぶSQL徹底指南書
2章:必ずわかるウインドウ関数

本文中に書かれている内容を実行したかったので、自分用にメモ。
※本のサンプルと行の順序が異なる場合あり

CREATE

CREATE TABLE LoadSample (
  sample_date varchar(255),
  load_val int
) charset utf8mb4;

CREATE TABLE ServerLoadSample (
  server varchar(255),
  sample_date varchar(255),
  load_val int
) charset utf8mb4;

INSERT

INSERT INTO LoadSample VALUES
('2018-02-01', 1024),
('2018-02-02', 2366),
('2018-02-05', 2366),
('2018-02-07', 985),
('2018-02-08', 780),
('2018-02-12', 1000);

INSERT INTO ServerLoadSample VALUES
('A', '2018-02-01', 1024),
('A', '2018-02-02', 2366),
('A', '2018-02-05', 2366),
('A', '2018-02-07', 985),
('A', '2018-02-08', 780),
('A', '2018-02-12', 1000),
('B', '2018-02-01', 54),
('B', '2018-02-02', 39008),
('B', '2018-02-03', 2900),
('B', '2018-02-04', 556),
('B', '2018-02-05', 12600),
('B', '2018-02-06', 7309),
('C', '2018-02-01', 1000),
('C', '2018-02-07', 2000),
('C', '2018-02-16', 500);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?