source: liacs/db/opdr2/create_db.sql@ 2

Last change on this file since 2 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

  • Property svn:executable set to *
File size: 2.4 KB
RevLine 
[2]1--name: Rick van der Zwet
2--sid: 0433373
3--file: ex2.sql
4--vak/opdracht: Databases/ opdracht 2
5
6DROP TABLE Sleep;
7DROP TABLE Coaches;
8DROP TABLE Coach;
9DROP TABLE Sportsman;
10
11CREATE TABLE Sportsman(
12 Sid integer NOT NULL,
13 Sname char(20),
14 Sage integer,
15 Scountry char(20),
16 PRIMARY KEY( Sid )
17);
18
19CREATE TABLE Coach(
20 Cid integer NOT NULL,
21 Cname char(20),
22 Cage integer,
23 Ccountry char(20),
24 PRIMARY KEY( Cid )
25);
26
27CREATE TABLE Coaches(
28 Cid integer,
29 Sid integer,
30 FOREIGN KEY ( Cid ) REFERENCES Coach( Cid ),
31 FOREIGN KEY ( Sid ) REFERENCES SportsMan( Sid )
32);
33
34
35CREATE TABLE Sleep(
36 Sid integer,
37 Branch char(20),
38 Day date,
39 NumHours integer,
40 PRIMARY KEY ( Sid, Day ),
41 FOREIGN KEY ( Sid ) REFERENCES SportsMan( Sid )
42);
43
44INSERT INTO Sportsman VALUES ( 1, 'Rick', 15, 'nl' );
45INSERT INTO Sportsman VALUES ( 2, 'Simoneer', 25, 'nl' );
46INSERT INTO Sportsman VALUES ( 3, 'Simone', 38, 'nl' );
47INSERT INTO Sportsman VALUES ( 4, 'Stefan', 20, 'de' );
48INSERT INTO Sportsman VALUES ( 5, 'Anton', 25, 'de' );
49INSERT INTO Sportsman VALUES ( 6, 'Henrich', 38, 'de' );
50INSERT INTO Sportsman VALUES ( 7, 'Huibert', 18, 'fr' );
51INSERT INTO Sportsman VALUES ( 8, 'Francios', 20, 'fr' );
52INSERT INTO Sportsman VALUES ( 9, 'Nancy', 30, 'fr' );
53INSERT INTO Sportsman VALUES ( 10, 'Rosa', 38, 'fr' );
54
55INSERT INTO Coach VALUES (1, 'coach 1', 10, 'nl' );
56INSERT INTO Coach VALUES (2, 'coach 2', 20, 'nl' );
57INSERT INTO Coach VALUES (3, 'coach 3', 30, 'de' );
58INSERT INTO Coach VALUES (4, 'coach 4', 40, 'de' );
59INSERT INTO Coach VALUES (5, 'coach 5', 50, 'de' );
60INSERT INTO Coach VALUES (6, 'coach 6', 60, 'fr' );
61INSERT INTO Coach VALUES (7, 'coach 7', 70, 'fr' );
62INSERT INTO Coach VALUES (8, 'coach 8', 80, 'fr' );
63
64INSERT INTO Coaches VALUES ( 1, 1 );
65INSERT INTO Coaches VALUES ( 2, 2 );
66INSERT INTO Coaches VALUES ( 2, 5 );
67INSERT INTO Coaches VALUES ( 3, 3 );
68INSERT INTO Coaches VALUES ( 3, 2 );
69INSERT INTO Coaches VALUES ( 4, 4 );
70INSERT INTO Coaches VALUES ( 5, 5 );
71INSERT INTO Coaches VALUES ( 6, 6 );
72INSERT INTO Coaches VALUES ( 7, 7 );
73INSERT INTO Coaches VALUES ( 8, 8 );
74
75INSERT INTO Sleep VALUES ( 1, 'judo', SYSDATE, 5 );
76INSERT INTO Sleep VALUES ( 1, 'judo', SYSDATE+1, 9 );
77INSERT INTO Sleep VALUES ( 1, 'judo', SYSDATE+2, 3 );
78INSERT INTO Sleep VALUES ( 2, 'judo', SYSDATE, 3 );
79INSERT INTO Sleep VALUES ( 3, 'judo', SYSDATE, 8 );
80INSERT INTO Sleep VALUES ( 4, 'zwemmen', SYSDATE, 6 );
81
Note: See TracBrowser for help on using the repository browser.