Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GoikLectures
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Goik Martin
GoikLectures
Commits
6e6c4db2
Commit
6e6c4db2
authored
10 years ago
by
Goik Martin
Browse files
Options
Downloads
Patches
Plain Diff
Airline example
parent
4698142a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Doc/P/Relational/schema.sql
+29
-0
29 additions, 0 deletions
Doc/P/Relational/schema.sql
Doc/course.xml
+104
-2
104 additions, 2 deletions
Doc/course.xml
with
133 additions
and
2 deletions
Doc/P/Relational/schema.sql
0 → 100644
+
29
−
0
View file @
6e6c4db2
DROP
TABLE
IF
EXISTS
Flight
;
DROP
TABLE
IF
EXISTS
Destination
;
DROP
TABLE
IF
EXISTS
Airline
;
CREATE
Table
Airline
(
id
INT
NOT
NULL
PRIMARY
KEY
,
name
CHAR
(
20
)
NOT
NULL
UNIQUE
,
airlineCode
CHAR
(
5
)
NOT
NULL
UNIQUE
);
CREATE
TABLE
Destination
(
id
INT
NOT
NULL
PRIMARY
KEY
,
fullName
CHAR
(
20
)
NOT
NULL
,
airportCode
CHAR
(
20
)
NOT
NULL
UNIQUE
);
CREATE
TABLE
Flight
(
id
INT
NOT
NULL
PRIMARY
KEY
,
flightNumber
CHAR
(
10
)
NOT
NULL
UNIQUE
,
airline
INT
NOT
NULL
REFERENCES
Airline
,
origin
int
NOT
NULL
REFERENCES
Destination
,
destination
int
NOT
NULL
REFERENCES
Destination
);
This diff is collapsed.
Click to expand it.
Doc/course.xml
+
104
−
2
View file @
6e6c4db2
...
...
@@ -594,9 +594,111 @@ drwxr-xr-x 4 goik fb1prof 4096 Nov 8 22:04 ..
connection.</para>
</section>
<section xml:id="toolingConfigJdbc">
<titleabbrev>Tooling</titleabbrev>
<section xml:id="repeatRelational">
<title>Some notes on relational databases</title>
<qandaset defaultlabel="qanda" xml:id="airlineRelationalSchema">
<title>Airlines, airports and flights </title>
<qandadiv>
<qandaentry>
<question>
<para>Implement a relational schema describing airlines,
flights, airports and their respective relationships:</para>
<itemizedlist>
<listitem>
<para>Airline:</para>
<itemizedlist>
<listitem>
<para>An informal unique name like e.g.
<quote>Lufthansa</quote>.</para>
</listitem>
<listitem>
<para>A unique <link
xlink:href="http://en.wikipedia.org/wiki/List_of_airline_codes">ICAO
abbreviation</link>. </para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>Destination</para>
<itemizedlist>
<listitem>
<para>Full name like <quote>Frankfurt am Main
International</quote></para>
</listitem>
<listitem>
<para>World airport code like
<quote>FRA</quote>.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>Flight</para>
<itemizedlist>
<listitem>
<para>A unique flight number e.g. LH 4234</para>
</listitem>
<listitem>
<para>The <quote>owning</quote> airline.</para>
</listitem>
<listitem>
<para>originating airport</para>
</listitem>
<listitem>
<para>destination airport</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
<para>Provide surrogate keys for all entities.</para>
</question>
<answer>
<programlisting language="sql">DROP TABLE IF EXISTS Flight;
DROP TABLE IF EXISTS Destination;
DROP TABLE IF EXISTS Airline;
CREATE Table Airline (
id INT NOT NULL PRIMARY KEY
,name CHAR(20) NOT NULL UNIQUE
,airlineCode CHAR(5)NOT NULL UNIQUE
);
CREATE TABLE Destination (
id INT NOT NULL PRIMARY KEY
,fullName CHAR(20) NOT NULL
,airportCode CHAR(20) NOT NULL UNIQUE
);
CREATE TABLE Flight (
id INT NOT NULL PRIMARY KEY
,flightNumber CHAR(10) NOT NULL UNIQUE
,airline INT NOT NULL REFERENCES Airline
,origin int NOT NULL REFERENCES Destination
,destination int NOT NULL REFERENCES Destination
);</programlisting>
</answer>
</qandaentry>
</qandadiv>
</qandaset>
</section>
<section xml:id="toolingConfigJdbc">
<title>Tooling: Configuring and using the <link
xlink:href="http://www.eclipse.org/datatools">Eclipse database
development</link> plugin</title>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment