## 새로운 데이터 베이스 생성
CREATE DATABASE dungeon_and_fighter;
## 사용할 DB 지정
USE dungeon_and_fighter;
## 테이블 생성
CREATE TABLE df(
index_ INT,
name VARCHAR(20),
combat_style VARCHAR(20),
difficulity INT,
power INT,
range_ INT,
speed INT,
support INT
);
INSERT INTO df(index_, name, combat_style, difficulity, power, range_, speed, support)
VALUES (1, "Berserker", "Pure", 1, 3, 2, 3, 1),
(2, "Nen-Master", "Pure", 2, 3, 2, 3, 1),
(3, "Street-Fighter", "Synergy", 4, 2, 2, 2, 2),
(4, "Glacier", "Pure", 1, 3, 2, 2, 1),
(5,"Crusader", "Buffer", 2, 1, 2, 1, 3);
SELECT *
FROM df;
총 전투력=(공격력+범위+속도+서포트)/난이도
SELECT
name,
combat_style,
difficulity
FROM df;
SELECT
name,
power,
range_,
speed
FROM df;
SELECT
name,
(power+range_+speed+support)/difficulity AS total
FROM df;