add all required files for the recursion excercise
This commit is contained in:
parent
c40bb08fc9
commit
020a1bbd01
|
@ -0,0 +1,627 @@
|
|||
use bike_shop
|
||||
delete from struktur
|
||||
delete from teile
|
||||
go
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(1,'Stück','Rocky Mountain Element Race', 'Artikel',
|
||||
2600,0, 20, 10, 20, 20, 2, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(2,'Stück','Rahmen Element Race', 'Baugruppe',
|
||||
300,0, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(3,'kg','Silberfarbe', 'Material',
|
||||
0,2, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(4,'kg','Sintermetall', 'Material',
|
||||
0,5, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(5,'Stück','Gabel SID XC', 'Material',
|
||||
0,1230, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(24,'Stück','Tretlager Race Face', 'Material',
|
||||
0,18, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(7,'Stück','Kurbelsatz Race Face', 'Material',
|
||||
0,18, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(8,'Stück','Schaltwerk XTR', 'Material',
|
||||
0,150, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(9,'Stück','Pedale Shimano 747', 'Material',
|
||||
0,5, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(10,'Stück','Schalthebel Grip Shift', 'Material',
|
||||
0,79, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(11,'Stück','Rad xtr', 'Baugruppe',
|
||||
50,0, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(12,'Stück','Naben Mavic Crossmax', 'Material',
|
||||
0, 0.50 , 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(13,'Stück','Felgen Mavic Crossmax', 'Material',
|
||||
0, 0.60 , 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(14,'Stück','Speichen Mavic Crossmax', 'Material',
|
||||
0, 0.50 , 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(15,'Stück','Bereifung Richtey, Vo: Z-Max ', 'Material',
|
||||
0, 22, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(16,'Stück','Steuersatz Chris King', 'Material',
|
||||
0, 28, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(17,'Stück','Vorbau Control Tech', 'Material',
|
||||
0, 28, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(18,'Stück','Lenker Answer Hyperlite', 'Material',
|
||||
0, 109, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(19,'Stück','Griffe LGrip Shift ', 'Material',
|
||||
0, 10, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(20,'Stück','Bremshebel XTR', 'Material',
|
||||
0, 11, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(21,'Stück','Bremsen XTR', 'Material',
|
||||
0, 110, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(22,'Stück','Sattel Flite', 'Material',
|
||||
0, 60, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(28,'Stück','Bremse Shimano Alivio Cantilever ', 'Material',
|
||||
0, 29, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(23,'Stück','Sattelstütze Syncros', 'Material',
|
||||
0, 28, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(25,'Stück','Bremse Shimano XTR V-Brake ', 'Material',
|
||||
0, 149, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(26,'Stück','GABEL TOP GUN ', 'Material',
|
||||
0, 299, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(27,'Stück','Shimano STX-RC i', 'Material',
|
||||
0,69, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(29,'Stück','Rahmen Cannondale CAD3 Headshok', 'Material',
|
||||
0,1590, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(30,'Stück','Rahmen Super V', 'Material',
|
||||
0,2590, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(31,'Stück','Herrenrad GT-LTS 18', 'Artikel',
|
||||
3000,0, 20, 10, 20, 20, 2, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(32,'Stück','Rahmen GT-LTS 18"', 'Baugruppe',
|
||||
300,0, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(33,'kg','Vb-Farbe', 'Material',
|
||||
0,2, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(34,'kg','Aluminium', 'Material',
|
||||
0,8, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(35,'Stück','RST Hi-5', 'Material',
|
||||
0,30, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(36,'Stück','Race Face (TITAN)', 'Material',
|
||||
0,18, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(37,'Stück','Kurbelsatz Ritchey Logic', 'Material',
|
||||
0,19, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(38,'Stück','Schaltwerk XTR inverse', 'Material',
|
||||
0,252, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(39,'Stück','Pedale XT', 'Material',
|
||||
0,9, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(40,'Stück','Schalthebel Grip Shift 4', 'Material',
|
||||
0,9, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(41,'Stück','Rad XTR 47', 'Baugruppe',
|
||||
60,0, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(42,'Stück','Naben Inferno', 'Material',
|
||||
0, 0.50 , 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(43,'Stück','Felgen Inferno', 'Material',
|
||||
0, 0.60 , 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(44,'Stück','Speichen Mavic Crossmax', 'Material',
|
||||
0, 0.50 , 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(45,'Stück','Bereifung Continental ', 'Material',
|
||||
0, 22, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(46,'Stück','Steuersatz Race Face', 'Material',
|
||||
0, 28, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(47,'Stück','Vorbau Syncros', 'Material',
|
||||
0, 70, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(48,'Stück','Lenker Syncros (Downhill)', 'Material',
|
||||
0, 140, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(49,'Stück','Griffe LGrip Shift ', 'Material',
|
||||
0, 10, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(50,'Stück','Bremshebel TWP G-Force', 'Material',
|
||||
0, 17, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(51,'Stück','Bremsen Magura Race Line', 'Material',
|
||||
0, 150, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(52,'Stück','Sattel Selle Flite Titanium', 'Material',
|
||||
0, 80, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(53,'Stück','Sattelstütze XTR', 'Material',
|
||||
0, 30, 20, 10, 10, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(54,'Stück','Klapprad Prompton P3', 'Artikel',
|
||||
0, 1200, 20, 10, 10, 10, 0, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(55,'Stück','CANNONDALE FSL', 'Artikel',
|
||||
0, 4200, 20, 10, 10, 10, 0, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(56,'Stück','HERCULES NEPAL', 'Artikel',
|
||||
0, 1200, 20, 10, 10, 10, 0, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(57,'Stück','Steppenwolf TAO', 'Artikel',
|
||||
0, 1600, 20, 10, 10, 10, 0, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(58,'Stück','SWITCHBACK AGENT', 'Artikel',
|
||||
0, 599, 20, 10, 10, 10, 0, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(59,'Stück','STEVENS R.P.R.2 RX100 8FACH', 'Artikel',
|
||||
0, 1700, 20, 10, 10, 10, 0, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(60,'Stück','Scott ATACAMA TOUR', 'Artikel',
|
||||
0, 1899, 20, 10, 10, 10, 0, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(61,'Stück','ROTWILD RCC-03', 'Artikel',
|
||||
0, 3280, 20, 10, 10, 10, 0, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO teile
|
||||
VALUES
|
||||
(62,'Stück','Lenker', 'Baugruppe',
|
||||
0, 280, 20, 10, 10, 10, 0, 0, 0, getdate())
|
||||
|
||||
go
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 2, 1, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(2, 3, 2, 10, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(2, 4, 3, 20, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 5, 4, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 24, 5, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 7, 6, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 8, 7, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 9, 8, 2, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 10, 9, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 11, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 16, 11, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 17, 12, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 18, 13, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 19, 14, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 20, 15, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 21, 16, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 22, 17, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(1, 23, 18, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(11, 12, 1, 50, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(11, 13, 2, 50, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(11, 14, 3, 50, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(11, 15, 4, 2, 0, 0, getdate())
|
||||
|
||||
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 32, 1, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(32, 33, 2, 10, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(32, 34, 3, 20, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 35, 4, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 44, 5, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 37, 6, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 38, 7, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 39, 8, 2, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 40, 9, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 41, 10, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 46, 11, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 47, 12, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 48, 13, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 49, 14, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 50, 15, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 51, 16, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 52, 17, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(31, 53, 18, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(41, 42, 1, 50, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(41, 43, 2, 50, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(41, 44, 3, 50, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(41, 45, 4, 2, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(60, 2, 1, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(60, 41, 1, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(60, 62, 1, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(62, 49, 1, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(62, 40, 1, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(40, 34, 1, 1, 0, 0, getdate())
|
||||
|
||||
|
||||
INSERT INTO struktur
|
||||
VALUES
|
||||
(40, 3, 1, 1, 0, 0, getdate())
|
|
@ -0,0 +1,10 @@
|
|||
-- Dateiname create_database.sql
|
||||
--
|
||||
-- Beschreibung: recursion excercise
|
||||
--
|
||||
-- Autor: Andreas Zweili
|
||||
-- Datum: 2017-05-28
|
||||
-- Server Version: SQL Server 2016
|
||||
|
||||
if not exists (select * from sys.databases where name='bike_shop')
|
||||
CREATE DATABASE bike_shop;
|
|
@ -0,0 +1,52 @@
|
|||
-- Dateiname create_table.sql
|
||||
--
|
||||
-- Beschreibung: recursion excercise
|
||||
--
|
||||
-- Autor: Andreas Zweili
|
||||
-- Datum: 2017-05-28
|
||||
-- Server Version: SQL Server 2016
|
||||
|
||||
use bike_shop
|
||||
if not exists (select * from sysobjects where name='teile')
|
||||
CREATE TABLE teile(
|
||||
TNr int not null,
|
||||
Me varchar(10),
|
||||
Bezeichnung varchar(50),
|
||||
Typ varchar(50),
|
||||
Herstellkosten float,
|
||||
Einkaufspreis float,
|
||||
Mindestbestand int,
|
||||
Bestand int,
|
||||
Lieferzeit int,
|
||||
Herstelldauer int,
|
||||
Gewicht int,
|
||||
Reserviert int,
|
||||
Verfügbar int,
|
||||
Zeitstempel DATE,
|
||||
constraint PK_TNr primary key (TNr)
|
||||
);
|
||||
|
||||
use bike_shop
|
||||
if not exists (select * from sysobjects where name='struktur')
|
||||
CREATE TABLE struktur(
|
||||
OTeil int,
|
||||
UTeil int,
|
||||
Position int not null,
|
||||
Menge int,
|
||||
Ausschuss int,
|
||||
Arbeitsgang int,
|
||||
Zeitstempel DATE,
|
||||
constraint PK_POS primary key (OTeil, UTeil, Position)
|
||||
);
|
||||
|
||||
-- Foreign Key Constraints hinzufügen
|
||||
IF OBJECT_ID('dbo.[FK_OTeil]', 'O') IS NULL
|
||||
ALTER TABLE struktur ADD CONSTRAINT FK_OTeil
|
||||
FOREIGN KEY (OTeil) REFERENCES teile (TNr);
|
||||
go
|
||||
|
||||
-- Foreign Key Constraints hinzufügen
|
||||
IF OBJECT_ID('dbo.[FK_UTeil]', 'U') IS NULL
|
||||
ALTER TABLE struktur ADD CONSTRAINT FK_UTeil
|
||||
FOREIGN KEY (UTeil) REFERENCES teile (TNr);
|
||||
go
|
|
@ -1,9 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<SqlWorkbenchSqlProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="SqlWorkbenchSqlProject">
|
||||
<?xml version="1.0"?>
|
||||
<SqlWorkbenchSqlProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="recursion_excercise">
|
||||
<Items>
|
||||
<LogicalFolder Name="Connections" Type="2" />
|
||||
<LogicalFolder Name="Queries" Type="0" />
|
||||
<LogicalFolder Name="Miscellaneous" Type="3" />
|
||||
|
||||
<LogicalFolder Name="Connections" Type="2" Sorted="true">
|
||||
<Items>
|
||||
<ConnectionNode Name="WIN-10-SFR\SQL2016:WIN-10-SFR\andreas">
|
||||
<Created>2017-05-28T14:55:42.7426112+02:00</Created>
|
||||
<Type>SQL</Type>
|
||||
<Server>WIN-10-SFR\SQL2016</Server>
|
||||
<UserName />
|
||||
<Authentication>Windows Authentication</Authentication>
|
||||
<InitialDB />
|
||||
<LoginTimeout>15</LoginTimeout>
|
||||
<ExecutionTimeout>0</ExecutionTimeout>
|
||||
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
|
||||
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
|
||||
</ConnectionNode>
|
||||
</Items>
|
||||
</LogicalFolder>
|
||||
<LogicalFolder Name="Queries" Type="0" Sorted="true">
|
||||
<Items>
|
||||
<FileNode Name="create_database.sql">
|
||||
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:WIN-10-SFR\SQL2016:True</AssociatedConnectionMoniker>
|
||||
<AssociatedConnSrvName>WIN-10-SFR\SQL2016</AssociatedConnSrvName>
|
||||
<AssociatedConnUserName />
|
||||
<FullPath>create_database.sql</FullPath>
|
||||
</FileNode>
|
||||
<FileNode Name="create_table.sql">
|
||||
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:WIN-10-SFR\SQL2016:True</AssociatedConnectionMoniker>
|
||||
<AssociatedConnSrvName>WIN-10-SFR\SQL2016</AssociatedConnSrvName>
|
||||
<AssociatedConnUserName />
|
||||
<FullPath>create_table.sql</FullPath>
|
||||
</FileNode>
|
||||
<FileNode Name="remove_database.sql">
|
||||
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:WIN-10-SFR\SQL2016:True</AssociatedConnectionMoniker>
|
||||
<AssociatedConnSrvName>WIN-10-SFR\SQL2016</AssociatedConnSrvName>
|
||||
<AssociatedConnUserName />
|
||||
<FullPath>remove_database.sql</FullPath>
|
||||
</FileNode>
|
||||
<FileNode Name="TeileInsert.sql">
|
||||
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:WIN-10-SFR\SQL2016:True</AssociatedConnectionMoniker>
|
||||
<AssociatedConnSrvName>WIN-10-SFR\SQL2016</AssociatedConnSrvName>
|
||||
<AssociatedConnUserName />
|
||||
<FullPath>TeileInsert.sql</FullPath>
|
||||
</FileNode>
|
||||
</Items>
|
||||
</LogicalFolder>
|
||||
<LogicalFolder Name="Miscellaneous" Type="3" Sorted="true">
|
||||
<Items />
|
||||
</LogicalFolder>
|
||||
</Items>
|
||||
</SqlWorkbenchSqlProject>
|
|
@ -0,0 +1,17 @@
|
|||
-- Removes the bike_shop DB
|
||||
--
|
||||
-- Author: Andreas Zweili
|
||||
-- Erstellt: 2017-05-28
|
||||
-- DB-Server SQL Server 2016
|
||||
|
||||
use bike_shop;
|
||||
|
||||
if exists (select * from sysobjects where name='teile')
|
||||
drop table teile;
|
||||
|
||||
if exists (select * from sysobjects where name='struktur')
|
||||
drop table struktur;
|
||||
|
||||
use master;
|
||||
if exists (select * from sys.databases where name='bike_shop')
|
||||
drop DATABASE bike_shop;
|
|
@ -0,0 +1,23 @@
|
|||
-- Dateiname selections.sql
|
||||
--
|
||||
-- Beschreibung: recursion excercise
|
||||
--
|
||||
-- Autor: Andreas Zweili
|
||||
-- Datum: 2017-05-28
|
||||
-- Server Version: SQL Server 2016
|
||||
|
||||
use Luftfahrzeuge
|
||||
select l.LFZ_ID, l.LFZ_HERSTELLER, l.LFZ_BAUJAHR,
|
||||
f.FLU_SPANNWEITE from Luftfahrzeug l
|
||||
inner join Flugzeug f
|
||||
on f.FLZ_ID = l.LFZ_ID;
|
||||
|
||||
select l.LFZ_ID, l.LFZ_HERSTELLER, l.LFZ_BAUJAHR,
|
||||
h.HUB_ROTORDURCHMESSER from Luftfahrzeug l
|
||||
inner join Hubschrauber h
|
||||
on h.HUB_ID = l.LFZ_ID;
|
||||
|
||||
select l.LFZ_ID, l.LFZ_HERSTELLER, l.LFZ_BAUJAHR,
|
||||
z.ZEP_GASVOLUMEN from Luftfahrzeug l
|
||||
inner join Zeppelin z
|
||||
on z.ZEP_ID = l.LFZ_ID;
|
Reference in New Issue