Page MenuHomeMnkras Phabricator

(An Untitled Masterwork)
ActivePublic

Authored by Mnkras on Feb 8 2017, 3:46 PM.
CREATE TABLE `Classes` (
`class` VARCHAR(255) PRIMARY KEY,
`type` VARCHAR(2),
`country` VARCHAR(255),
`numGuns` INT,
`bore` INT,
`displacement` INT
);
CREATE TABLE `Ships` (
`name` VARCHAR(255) PRIMARY KEY,
`class` VARCHAR(255),
`launched` INT
);
CREATE TABLE `Battles` (
`name` VARCHAR(255) PRIMARY KEY,
`date` DATE /* or VARCHAR(255) */
);
CREATE TABLE `Outcomes` (
`ship` VARCHAR(255),
`battle` VARCHAR(255),
`result` VARCHAR(7)
);
ALTER TABLE `Classes` DROP COLUMN `bore`;
ALTER TABLE `Ships` ADD `yard` VARCHAR(255);
SELECT `class`, `country` FROM `Classes` WHERE `bore` >= 16;
SELECT `name` FROM `Ships` WHERE `launched` < 1921;
SELECT `ship` FROM `Outcomes` WHERE `battle` = 'Denmark Strait' AND `result` = 'sunk';
SELECT Ships.name FROM `Ships` JOIN `Classes` ON Ships.class = Classes.class WHERE Ships.launched > 1921 AND Classes.displacement > 35000;
Mnkras created this paste.Feb 8 2017, 3:46 PM
Mnkras created this object with visibility "Public (No Login Required)".
Mnkras updated the paste's language from autodetect to sql.
Mnkras edited the content of this paste. (Show Details)