-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.sql
108 lines (54 loc) · 1.73 KB
/
script.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
PRAGMA foreign_keys=on
CREATE TABLE IF NOT EXISTS Country
(
CodeCountry INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
NameCountry TEXT NOT NULL
)
CREATE TABLE IF NOT EXISTS Resort
(
IDResort INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
NameResort TEXT NOT NULL,
DescriptionResort TEXT NOT NULL,
CodeOfTheCountry INTEGER NOT NULL,
FOREIGN KEY (CodeOfTheCountry) REFERENCES Country(CodeCountry)
)
CREATE TABLE IF NOT EXISTS Hotel
(
IDHotel INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
HotelCategory INTEGER NOT NULL,
Name TEXT NOT NULL,
HotelDescription TEXT NOT NULL,
id_Resort INTEGER NOT NULL,
FOREIGN KEY (id_Resort) REFERENCES Resort(IDResort)
)
CREATE TABLE IF NOT EXISTS Flight
(
FlightNumber INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
Destination TEXT NOT NULL,
DepartureDate NUMERIC NOT NULL,
Price REAL NOT NULL,
TravelTime TEXT NOT NULL,
id_Resort INTEGER NOT NULL,
FOREIGN KEY (id_Resort) REFERENCES Resort(IDResort)
)
CREATE TABLE IF NOT EXISTS Client
(
IdClient INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
FIOName TEXT NOT NULL,
address TEXT NOT NULL,
DateOfBirth NUMERIC NOT NULL,
telephone INTEGER NOT NULL
)
CREATE TABLE IF NOT EXISTS Tour
(
IDTour INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
Descripte TEXT NOT NULL,
ID_Client INTEGER NOT NULL,
ID_Hotel INTEGER NOT NULL,
Flight_Number INTEGER NOT NULL,
FOREIGN KEY (ID_Client) REFERENCES Client(IdClient),
FOREIGN KEY (ID_Hotel) REFERENCES Hotel(IDHotel),
FOREIGN KEY (Flight_Number) REFERENCES Flight(FlightNumber)
)
c.execute("DELETE FROM SHPKD WHERE decimal='%s' AND recordnumber='%s'" % (self.decimal_to_edit,
self.selected_key))