Skip to content
Snippets Groups Projects
Commit df5067ab authored by Goik Martin's avatar Goik Martin
Browse files

Airline example corrected

parent cec1e3cb
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@
</listitem>
<listitem>
<para>Upload to <uri
<para>Upload to <uri
xlink:href="https://learn.mi.hdm-stuttgart.de/files/CheatSheet">https://learn.mi.hdm-stuttgart.de/files/CheatSheet</uri>.</para>
</listitem>
......@@ -31,14 +31,13 @@
<listitem>
<para>Subsequent transfer to read-only location <uri
xlink:href="https://klausur.mi.hdm-stuttgart.de/files/goik/CheatSheet">https://klausur.mi.hdm-stuttgart.de/files/goik/CheatSheet</uri>
accessible during exam time.</para>
accessible during exam time.</para>
</listitem>
<listitem>
<para><emphasis role="red">Check your transferred archive prior to
examination!</emphasis></para>
</listitem>
</itemizedlist>
</figure>
......@@ -263,8 +262,8 @@ PGPASSWORD=XYZ psql -h localhost --username=hdmuser -d hdm <co
server:</para>
<figure xml:id="sda1_fig_mysqlDriverByAptitude">
<title>Installing <xref linkend="glo_Soft_Postgresql"/> JDBC driver using the
<command
<title>Installing <xref linkend="glo_Soft_Postgresql"/> JDBC driver
using the <command
xlink:href="https://linux.die.net/man/8/aptitude">aptitude</command>.</title>
<screen>#&gt; apt-get install libpostgresql-jdbc-java</screen>
......@@ -376,7 +375,8 @@ PGPASSWORD=XYZ psql -h localhost --username=hdmuser -d hdm <co
</listitem>
<listitem>
<para>Constraint: origin and destination must differ.</para>
<para>Constraint: origin and destination must
differ.</para>
</listitem>
</itemizedlist>
</listitem>
......@@ -396,38 +396,40 @@ DROP TABLE IF EXISTS Destination;
DROP TABLE IF EXISTS Airline;
CREATE Table Airline (
id INT NOT NULL
,name CHAR(20) NOT NULL
,airlineCode CHAR(5) NOT NULL
id INT NOT NULL
,name CHAR(20) NOT NULL
,airlineCode CHAR(5) NOT NULL
,CONSTRAINT _PK_Airline_id PRIMARY KEY(id)
,CONSTRAINT _UN_Airline_name UNIQUE(name)
,CONSTRAINT _UN_Airline_airlineCode UNIQUE(airlineCode)
,CONSTRAINT _PK_Airline_id PRIMARY KEY(id)
,CONSTRAINT _UN_Airline_name UNIQUE(name)
,CONSTRAINT _UN_Airline_airlineCode UNIQUE(airlineCode)
);
CREATE TABLE Destination (
id INT NOT NULL
,fullName CHAR(20) NOT NULL
,airportCode CHAR(5)
id INT NOT NULL
,fullName CHAR(20) NOT NULL
,airportCode CHAR(5)
,CONSTRAINT _PK_Destination_id PRIMARY KEY(id)
,CONSTRAINT _UN_Destination_airportCode UNIQUE(airportCode)
,CONSTRAINT _PK_Destination_id PRIMARY KEY(id)
,CONSTRAINT _UN_Destination_airportCode UNIQUE(airportCode)
);
CREATE TABLE Flight (
id INT NOT NULL
,flightNumber CHAR(10) NOT NULL
,airline INT NOT NULL
,origin int NOT NULL
,destination int NOT NULL
id INT NOT NULL
,flightNumber CHAR(10) NOT NULL
,airline INT NOT NULL
,origin int NOT NULL
,destination int NOT NULL
,CONSTRAINT _PK_Flight_id UNIQUE(id)
,CONSTRAINT _UN_Flight_flightNumber UNIQUE(flightNumber)
,CONSTRAINT _PK_Flight_id UNIQUE(id)
,CONSTRAINT _UN_Flight_flightNumber UNIQUE(flightNumber)
,CONSTRAINT _PK_Flight_ref_origin FOREIGN KEY (origin) REFERENCES Destination(id)
,CONSTRAINT _PK_Flight_ref_destination FOREIGN KEY (destination) REFERENCES Destination(id)
,CONSTRAINT _PK_Flight_ref_airline FOREIGN KEY (origin) REFERENCES Airline(id)
,CONSTRAINT _CK_Flight_origin_destination CHECK(NOT(origin = destination))
,CONSTRAINT _PK_Flight_ref_origin FOREIGN KEY (origin) REFERENCES Destination(id)
,CONSTRAINT _PK_Flight_ref_destination FOREIGN KEY (destination) REFERENCES Destination(id)
,CONSTRAINT _CK_Flight_origin_destination CHECK(NOT(origin = destination))
);</programlisting>
<para>Compact version using auto generated constraint
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment