-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MSSQL copy pasting for querying to follow along in Microsoft DBMS
- Loading branch information
Showing
1 changed file
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
CREATE DATABASE Mars; | ||
|
||
CREATE TABLE martian( | ||
martian_id INTEGER IDENTITY(1,1) PRIMARY KEY, | ||
first_name NVARCHAR(25), | ||
last_name NVARCHAR(25), | ||
base_id INTEGER, | ||
super_id INTEGER); | ||
|
||
INSERT INTO martian | ||
(first_name, last_name, base_id, super_id) | ||
VALUES | ||
( 'Ray', 'Bradbury', 1, NULL), | ||
( 'John', 'Black', 4, 10), | ||
( 'Samuel', 'Hinkston', 4, 2), | ||
( 'Jeff', 'Spender', 1, 9), | ||
( 'Sam', 'Parkhill', 2, 12), | ||
( 'Elma', 'Parkhill', 3, 8), | ||
( 'Melissa', 'Lewis', 1, 1), | ||
( 'Mark', 'Watney', 3, NULL), | ||
( 'Beth', 'Johanssen', 1, 1), | ||
( 'Chris', 'Beck', 4, NULL), | ||
( 'Nathaniel', 'York', 4, 2), | ||
( 'Elon', 'Musk', 2, NULL), | ||
( 'John', 'Carter', NULL, 8); | ||
|
||
CREATE TABLE visitor( | ||
visitor_id INTEGER IDENTITY(1,1) PRIMARY KEY, | ||
host_id INTEGER, | ||
first_name NVARCHAR(25), | ||
last_name NVARCHAR(25) | ||
); | ||
|
||
INSERT INTO visitor | ||
( host_id, first_name, last_name) | ||
VALUES | ||
( 7, 'George', 'Ambrose'), | ||
( 1, 'Kris', 'Cardenas'), | ||
( 9, 'Priscilla', 'Lane'), | ||
( 11, 'Jane', 'Thornton'), | ||
( NULL, 'Doug', 'Stavenger'), | ||
( NULL, 'Jamie', 'Waterman'), | ||
( 8, 'Martin', 'Humphries'); | ||
|
||
CREATE TABLE base( | ||
base_id INT IDENTITY(1,1) PRIMARY KEY, | ||
base_name NVARCHAR(30), | ||
founded DATETIME2 | ||
); | ||
|
||
|
||
INSERT INTO base | ||
(base_name, founded) | ||
VALUES | ||
( 'Tharsisland', '2037-06-03'), | ||
( 'Valles Marineris 2.0', '2040-12-01'), | ||
( 'Gale Cratertown', '2014-08-16'), | ||
( 'New New New York', '2042-02-10'), | ||
( 'Olympus Mons Spa & Casino', NULL); | ||
|
||
CREATE TABLE supply( | ||
supply_id INTEGER IDENTITY(1,1) PRIMARY KEY, | ||
name NVARCHAR(30), | ||
description NVARCHAR(MAX), | ||
quantity INTEGER | ||
); | ||
|
||
INSERT INTO supply | ||
( name, description, quantity) | ||
VALUES | ||
( 'Solar Panel', 'Standard 1x1 meter cell', 912), | ||
( 'Water Filter', 'This takes things out of your water so it''s drinkable.', 6), | ||
( 'Duct Tape', 'A 10 meeter roll of duct tape for ALL your repairs', 951), | ||
( 'Ketchup', 'It''s ketchup', 206), | ||
( 'Battery Cell', 'Standard 1000 kAH battery cell for power grid (heavy item).', 17), | ||
( 'USB 6.0 Cable', 'Carbon fiber cooated / 10 TBps spool', 42), | ||
( 'Fuzzy Duster', 'It gets dusty around here. Be prepared!', 19), | ||
( 'Mars Bars', 'The ORIGINAL nutirent bar made with the finest bioengineered ingredients.', 3801), | ||
( 'Air Filter', 'Removes 99% of all Martian dust from your ventilation unit', 23), | ||
( 'Famous Ray''s Frozen Pizza', 'This Martian favourite is covered in all your favourite toppings. 1 flavour only.', 823); | ||
|
||
|
||
CREATE TABLE inventory( | ||
base_id INTEGER, | ||
supply_id INTEGER, | ||
quantity INTEGER | ||
); | ||
|
||
INSERT INTO inventory | ||
(base_id, supply_id, quantity) | ||
VALUES | ||
(1, 1, 8), | ||
(1, 3, 5), | ||
(1, 5, 1), | ||
(1, 6, 2), | ||
(1, 8, 12), | ||
(1, 9, 1), | ||
(2, 4, 5), | ||
(2, 8, 62), | ||
(2, 10, 37), | ||
(3, 2, 11), | ||
(3, 7, 2), | ||
(4, 10, 91); | ||
|
||
CREATE TABLE martian_confidential( | ||
martian_id INTEGER IDENTITY(1,1) PRIMARY KEY, | ||
first_name NVARCHAR(25), | ||
last_name NVARCHAR(25), | ||
base_id INTEGER, | ||
super_id INTEGER, | ||
salary INTEGER, | ||
dna_id NVARCHAR(30) | ||
); | ||
|
||
INSERT INTO martian_confidential | ||
( first_name, last_name, base_id, super_id, salary, dna_id) | ||
VALUES | ||
( 'Ray', 'Bradbury', 1, NULL, 155900, 'gctaggaatgtagaatctcctgttg'), | ||
( 'John', 'Black', 4, 10, 120100, 'cagttaatggttgaagctggggatt'), | ||
( 'Samuel', 'Hinkston', 4, 2, 110000, 'cgaagcgctagatgctgtgttgtag'), | ||
( 'Jeff', 'Spender', 1, 9, 10000, 'gactaatgtcttcgtggattgcaga'), | ||
( 'Sam', 'Parkhill', 2, 12, 125000, 'gttactttgcgaaagccgtggctac'), | ||
( 'Elma', 'Parkhill', 3, 8, 137000, 'gcaggaatggaagcaactgccatat'), | ||
( 'Melissa', 'Lewis', 1, 1, 145250, 'cttcgatcgtcaatggagttccggac'), | ||
( 'Mark', 'Watney', 3, NULL, 121100, 'gacacgaggcgaactatgtcgcggc'), | ||
( 'Beth', 'Johanssen', 1, 1, 130000, 'cttagactaggtgtgaaacccgtta'), | ||
( 'Chris', 'Beck', 4, NULL, 125000, 'gggggggttacgacgaggaatccat'), | ||
( 'Nathaniel', 'York', 4, 2, 105000, 'ggtctccctgggcgggatattggatg'), | ||
( 'Elon', 'Musk', 2, NULL, 155800, 'atctgcttggatcaatagcgctgcg'), | ||
( 'John', 'Carter', NULL, 8, 129500, 'ccaatcgtgcgagtcgcgatagtct'); |