SHARE
TWEET

databaseSH

a guest May 31st, 2017 508 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. USE master;
  2. DROP DATABASE Studenterhuset;
  3. CREATE DATABASE Studenterhuset;
  4.  
  5. GO
  6.  
  7. USE Studenterhuset;
  8.  
  9. CREATE TABLE Performers(
  10.     code VARCHAR(4),
  11.     name VARCHAR(50) NOT NULL,
  12.     genre VARCHAR(50) NOT NULL,
  13.     [description] VARCHAR(50),
  14.     nationality VARCHAR(50),
  15.     link VARCHAR(255),
  16.     PRIMARY KEY (code)
  17. );
  18.  
  19. CREATE TABLE Zip(
  20.     zipCode VARCHAR(50),
  21.     city VARCHAR(50) NOT NULL,
  22.     PRIMARY KEY (zipCode)
  23. );
  24.  
  25. CREATE TABLE Place(
  26.     id INT,
  27.     name VARCHAR(50) NOT NULL,
  28.     street VARCHAR(100),
  29.     NUMBER INT,
  30.     country VARCHAR(50),
  31.     zipCode VARCHAR(50),
  32.     PRIMARY KEY (id),
  33.     FOREIGN KEY (zipCode) REFERENCES Zip(zipCode)
  34.         ON UPDATE cascade
  35.         ON DELETE cascade
  36. );
  37.  
  38. CREATE TABLE Sponsors(
  39.     code VARCHAR(4),
  40.     name VARCHAR(50) NOT NULL,
  41.     [description] VARCHAR(255),
  42.     voucherCode VARCHAR(4),
  43.     PRIMARY KEY (code),
  44. );
  45.  
  46. CREATE TABLE Vouchers(
  47.     code VARCHAR(4),
  48.     name VARCHAR(50) NOT NULL,
  49.     [description] VARCHAR(255),
  50.     price INT NOT NULL,
  51.     VALUE VARCHAR(50),
  52.     overAge VARCHAR(10),
  53.     sponsorCode VARCHAR(4),
  54.     PRIMARY KEY (code),
  55.     FOREIGN KEY (sponsorCode) REFERENCES Sponsors(code)
  56.         ON UPDATE cascade
  57.         ON DELETE cascade
  58. );
  59.  
  60. CREATE TABLE Poll(
  61.     id INT,
  62.     genreA VARCHAR(50) NOT NULL,
  63.     voteA INT NOT NULL,
  64.     genreB VARCHAR(50) NOT NULL,
  65.     voteB INT NOT NULL,
  66.     RESULT VARCHAR(50),
  67.     PRIMARY KEY (id)
  68. );
  69.  
  70. CREATE TABLE [Event](
  71.     id INT,
  72.     name VARCHAR(50) NOT NULL,
  73.     [description] VARCHAR(255) NOT NULL,
  74.     category VARCHAR(50),
  75.     price INT NOT NULL,
  76.     [DATE] DATE NOT NULL,
  77.     [FROM] VARCHAR(5),
  78.     [TO] VARCHAR(5),
  79.     placeId INT,
  80.     vouchersCode VARCHAR(4),
  81.     pollId INT,
  82.     PRIMARY KEY (id),
  83.     FOREIGN KEY (vouchersCode) REFERENCES Vouchers (code)
  84.         ON UPDATE cascade
  85.         ON DELETE cascade,
  86.     FOREIGN KEY (pollId) REFERENCES Poll (id)
  87.         ON UPDATE cascade
  88.         ON DELETE cascade,
  89. );
  90.  
  91. CREATE TABLE EventPerformers(
  92.     eventId INT,
  93.     performersCode VARCHAR(4),
  94.     FOREIGN KEY (eventId) REFERENCES [Event] (id)
  95.         ON UPDATE cascade
  96.         ON DELETE cascade,
  97.     FOREIGN KEY (performersCode) REFERENCES Performers(code)
  98.         ON UPDATE cascade  
  99.         ON DELETE cascade
  100. );
  101.  
  102. CREATE TABLE EventSponsors(
  103.     eventId INT,
  104.     sponsorsCode VARCHAR(4),
  105.     FOREIGN KEY (eventId) REFERENCES [Event] (id)
  106.         ON UPDATE cascade  
  107.         ON DELETE cascade,
  108.     FOREIGN KEY (sponsorsCode) REFERENCES Sponsors(code)
  109.         ON UPDATE no action  
  110.         ON DELETE no action
  111. );
  112.  
  113. CREATE TABLE Customer(
  114.     id INT,
  115.     name VARCHAR(50) NOT NULL,
  116.     gender VARCHAR(50),
  117.     age INT NOT NULL,
  118.     studies VARCHAR(50),
  119.     nationality VARCHAR(50),
  120.     phoneNo VARCHAR(50),
  121.     email VARCHAR(50),
  122.     PRIMARY KEY(id)
  123. );
  124.  
  125. CREATE TABLE EventCustomer(
  126.     eventId INT,
  127.     customerId INT,
  128.     FOREIGN KEY (eventId) REFERENCES [Event] (id)
  129.         ON UPDATE cascade  
  130.         ON DELETE cascade,
  131.     FOREIGN KEY (customerId) REFERENCES Customer(id)
  132.         ON UPDATE no action  
  133.         ON DELETE no action
  134. );
  135.  
  136.  
  137. INSERT INTO Performers VALUES ('TTD', 'Taste The Doom', 'Doom Metal', 'as the Doom pairs seven drams of small-batch and single-malt whiskies with doom metal tracks about 15 minutes long', '', 'http://tastethedoom.com/');
  138. INSERT INTO Performers VALUES ('AA', 'Abdu Ali', 'Mixt', 'In terms of genre, Ali’s take on baltimore club contains elements as diverse as noise rap, afro futurism, punk and ballroom. But most of all it’s energy. A wild, unapologetic energy that will in no way be limited by genres, rules or opinions.', ' Baltimore, USA', 'http://abduali.com/');
  139. INSERT INTO Performers VALUES ('IRAH', 'IRAH', 'Rock', 'IRAH makes alternative pop music inspired by both traditional ceremony music to modern melodic songwriting. It is a real magic hearing them all together performing.', ' Baltimore, USA', 'http://irahmusic.com/');
  140. INSERT INTO Performers VALUES ('PK', 'Pligten Kalder', 'Rock', 'Pligten Kalder is a Danish music trio consisting of journalist Torben Steno (elastikoptrukket optigan organ), rock singer Johan Olsen known from Power Corridors (vocals) and saxisten Peter Bech-Jessen.', ' DK', 'http://www.pligtenkalder.dk/');
  141. INSERT INTO Performers VALUES ('TRSF', 'The Rumour Said Fire', 'Folk/Indie', 'The Rumor Said Fire is a Danish music group, formed in 2008 by singer, songwriter and guitarist Jesper Lidang.', ' DK', 'http://therumoursaidfire.com/');
  142. INSERT INTO Performers VALUES ('CMS', 'Communions', 'Rock', 'Communions entered the Danish music scene, and in the same breath entered the critics by storm. The quartet won with their first two epics and intense live shows quickly the hearts of the audience.', ' DK', 'http://www.communionsband.com/');
  143. INSERT INTO Performers VALUES ('FH', 'First Hate', 'Indie', 'Danish First Hate is ready for the first visit to the Student House with a universe of lavish syntheses and intense melodies.', ' DK', 'http://www.firsthate.com/');
  144. INSERT INTO Performers VALUES ('FD', 'Fribytterdrømme', 'Universal', 'Danish Band.', ' Baltimore, DK ', 'https://fribytterdroemme.lnk.to/Superego');
  145. INSERT INTO Performers VALUES ('SPP', 'Sleepy Party People', 'Dream pop/Slowcore', 'Sleep Party People is the alias of musician Brian Batz, hailing from Denmark.', ' DK', 'https://www.facebook.com/SLEEPPARTYPEOPLE/');
  146.  
  147. INSERT INTO Zip VALUES ('9000', 'Aalborg');
  148. INSERT INTO Zip VALUES ('9200', 'Aalborg SV');
  149. INSERT INTO Zip VALUES ('9100', 'Aalborg');
  150. INSERT INTO Zip VALUES ('9220', 'Aalborg Øst');
  151. INSERT INTO Zip VALUES ('9210', 'Aalborg SØ');
  152.  
  153. INSERT INTO Place VALUES (1, 'Studenterhuset', 'Square SH', 3, 'Denmark', '9000');
  154. INSERT INTO Place VALUES (2, 'Studenterhuset2', 'Square Music', 5, 'Denmark', '9000');
  155. INSERT INTO Place VALUES (3, 'Aalborg Bibliotekerne', 'Rendsburggade ', 2 , 'Denmark', '9000');
  156. INSERT INTO Place VALUES (4, 'Bilka', 'Hobrovej', 450, 'Denmark', '9200');
  157.  
  158.  
  159. INSERT INTO Sponsors VALUES ('TBRG', 'Tuborg', 'Tuborg is typical and cheep beer', NULL);
  160. INSERT INTO Sponsors VALUES ('COKE', 'Coca-Cola', 'Buy Happiness', NULL);
  161. INSERT INTO Sponsors VALUES ('Studiecykel', 'Studiecykel.dk', 'Gratie Studiecykel? Timeld dig her!', NULL);
  162. INSERT INTO Sponsors VALUES ('RB', 'Red Bull', 'Giving people wings', NULL);
  163. INSERT INTO Sponsors VALUES ('SNPS', 'Snaps', 'Aalborg local drink', NULL);
  164.  
  165.  
  166.  
  167. INSERT INTO Vouchers VALUES ('2x1B', '2x1 beer', '2 beers for the price of 1', 25, '50%', 'yes', 'TBRG');
  168. INSERT INTO Vouchers VALUES ('75%E', '75% Entrance', '75% Entrance using mobile app', 60, '75%', 'no', NULL);
  169.  
  170. INSERT INTO Poll VALUES (1, 'Vocal', 1, 'Rock', 2, 'Dance Music');
  171. INSERT INTO Poll VALUES (2, 'Classical Music', 2, 'Reggaeton', 1, 'Vocal');
  172. INSERT INTO Poll VALUES (3, 'Indie Rock', 2, 'Pop', 3, 'Alternative Rock, Slowcore');
  173. INSERT INTO Poll VALUES (3, 'Alternative Music', 2, 'Electronic Music', 3, 'Metal');
  174.  
  175.  
  176. INSERT INTO [Event] VALUES (1, 'TASTE THE DOOM', 'Doom metal and malt whisky', 'Music Concert', 210, '2017-06-03','21:00', '23:59', 1, '75%E', 1);
  177. INSERT INTO [Event] VALUES (2, 'JUVENTUS VS REAL MADRID', 'Showing the grand final match on a big screen in our Café. May the best win.', 'Entertainment', 0, '2017-06-03', '20:45', '23:45', 1, '2x1B', 2);
  178. INSERT INTO [Event] VALUES (3, 'ABDU ALI', 'Abdu Ali does club music with elements as diverse rap sounds, afro futurism, punk and the balroom. A wild, unapologetic energy that will in no way be limited by genres, rules or opinions.', 'Music Concert', 90, '2017-06-10', '21:00', '23:59', 1, '2x1B', 1);
  179. INSERT INTO [Event] VALUES (4, 'IRAH', 'IRAH makes alternative pop music inspired by both traditional ceremony music to modern melodic songwriting. It is a real magic hearing them all together performing.', 'Music Concert', 85, '2017-09-28','21:00', '23:59', 1, '75%E', 2);
  180. INSERT INTO [Event] VALUES (5, 'PLIGTEN KALDER', 'Pligten Kalder present original and fearful Danish music. Duty Kalder makes serious and black songs with subtle underflows, but you do not have to be sad and you have fun while you are in.', 'Music Concert', 135, '2017-10-05','21:00', '23:59', 1, '75%E', 2);
  181. INSERT INTO [Event] VALUES (6, 'THE RUMOUR SAID FIRE', '+ Support', 'Music Concert', 135, '2017-10-07','21:00', '23:59', 1, '2x1B', 1);
  182. INSERT INTO [Event] VALUES (7, 'COMMUNIONS + FIRST HATE', 'Communions delivers intense and almost disturbing rock, inspired by British legends like Happy Mondays and The Stone Roses.', 'Music Concert', 85, '2017-10-12','21:00', '23:59', 1, '2x1B', 1);
  183. INSERT INTO [Event] VALUES (8, 'Fribytterdrømme', 'Expected fans can really enjoy experiencing one of Denmarks most promising and talented music names when the mentioned psych group wakes the songs from their most notorious second album to live in venues across the country + SUPPORT.', 'Music Concert', 85, '2017-10-13','21:00', '23:59', 1, '2x1B', 1);
  184. INSERT INTO [Event] VALUES (9, 'VELVET VOLUME', 'Three young and talented musicians with their amazing music.', 'Music Concert', 155, '2017-10-14','21:00', '23:59', 1, '75%E', 1);
  185. INSERT INTO [Event] VALUES (10, 'SLEEP PARTY PEOPLE', 'Brian Batz and his five-man live band are performing on stage wearing the characteristic rabbit masks in early December.', 'Music Concert', 100, '2017-12-02','21:00', '23:59', 1, '2x1B', 1);
  186.  
  187.  
  188.  
  189.  
  190.  
  191. INSERT INTO EventPerformers VALUES (1,'TTD');
  192. INSERT INTO EventPerformers VALUES (2,'AA');
  193. INSERT INTO EventPerformers VALUES (3,'IRAH');
  194. INSERT INTO EventPerformers VALUES (4,'PK');
  195. INSERT INTO EventPerformers VALUES (5,'TRSF');
  196. INSERT INTO EventPerformers VALUES (6,'CMS');
  197. INSERT INTO EventPerformers VALUES (7,'FH');
  198. INSERT INTO EventPerformers VALUES (8,'FD');
  199. INSERT INTO EventPerformers VALUES (9,'SPP');
  200.  
  201.  
  202. INSERT INTO EventSponsors VALUES (1,'TBRG');
  203. INSERT INTO EventSponsors VALUES (2,'COKE');
  204. INSERT INTO EventSponsors VALUES (3,'Studiecykel');
  205. INSERT INTO EventSponsors VALUES (4,'RB');
  206. INSERT INTO EventSponsors VALUES (5, 'SNPS');
  207.  
  208.  
  209. INSERT INTO Customer VALUES (1, 'Ignasi', 'M', 22, 'Computer Science', 'ES', '+34123456789', 'ignasi@mail.com');
  210. INSERT INTO Customer VALUES (2, 'David', 'M', 22, 'Computer Science', 'ES', '+34123456789', 'david@mail.com');
  211. INSERT INTO Customer VALUES (3, 'Libor', 'M', 20, 'Computer Science', 'SLK', '+34123456789', 'libor@mail.com');
  212. INSERT INTO Customer VALUES (4, 'Ionut', 'M', 19, 'Computer Science', 'RO', '+40729073831', 'ionut@mail.com');
  213. INSERT INTO Customer VALUES (5, 'Søren Kierkegaard', 'M', 42, 'Philosophy', 'DK ', '+4550654839', 'Kierkegaard@gmail.com');
  214. INSERT INTO Customer VALUES (6, 'Bjarne Stroustrup', 'M', 66, 'Computer Science/Engineering', 'DK ', '+4550239476', 'bjarne@stroustrup.com');
  215. INSERT INTO Customer VALUES (7, 'Emily Ratajkowski', 'F', 25, 'Acting', 'UK ', '+15417543010', 'Emily@ratajkowski.com');
  216.  
  217.  
  218.  
  219. INSERT INTO EventCustomer VALUES (1,1);
  220. INSERT INTO EventCustomer VALUES (1,2);
  221. INSERT INTO EventCustomer VALUES (1,4);
  222. INSERT INTO EventCustomer VALUES (2,1);
  223. INSERT INTO EventCustomer VALUES (2,3);
  224. INSERT INTO EventCustomer VALUES (2,4);
  225. INSERT INTO EventCustomer VALUES (3, 1);
  226. INSERT INTO EventCustomer VALUES (3, 2);
  227. INSERT INTO EventCustomer VALUES (4, 1);
  228. INSERT INTO EventCustomer VALUES (4, 2);
  229. INSERT INTO EventCustomer VALUES (5, 1);
  230. INSERT INTO EventCustomer VALUES (5, 2);
  231. INSERT INTO EventCustomer VALUES (6, 1);
  232. INSERT INTO EventCustomer VALUES (6, 2);
  233. INSERT INTO EventCustomer VALUES (7, 1);
  234. INSERT INTO EventCustomer VALUES (7, 2);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top