Presentation is loading. Please wait.

Presentation is loading. Please wait.

Information Systems & Semantic Web University of Koblenz Landau, Germany Advanced Data Modeling Relational Data Model continued Steffen Staab with Simon.

Similar presentations


Presentation on theme: "Information Systems & Semantic Web University of Koblenz Landau, Germany Advanced Data Modeling Relational Data Model continued Steffen Staab with Simon."— Presentation transcript:

1 Information Systems & Semantic Web University of Koblenz Landau, Germany Advanced Data Modeling Relational Data Model continued Steffen Staab with Simon Schenk TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A AAA

2 ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de2 Overview Relational algebra, named perspective Aggregates and grouping SQL Integrity constraints

3 ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de3 Constant { { a 1 = v 11, …, a n = v 1n }, … …… { a 1 = v k1, …, a n = v kn } }

4 ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de4 Union Let R1, R2 be relations with the same attributes. R1 [ R2 = { t | t 2 R 1 or t 2 R 2 }

5 ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de5 Union, example AB ® 1 ® 2 ¯ 1 AB ® 1 ® 2 ¯ 1 ¯ 3 AB ® 2 ¯ 3 R1R1 R2R2 R 1 [ R 2

6 ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de6 Renaming Let R be a relation whose set of attributes is a 1,…,a n, c 1,…,c m Let b 1, …, b n be distinct attributes such that {b 1, …, b n } Å { c 1, …, c m } = ; Then ½ a 1 ! b 1, …, a n ! b n (R) = {{b 1 = v 1, …, b n =v n, c 1 =w 1, …, c m =w m } | {a 1 = v 1, …, a n =v n, c 1 =w 1, …, c m =w m } 2 R}

7 ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de7 Set difference Let R 1, R 2 be relatations with the same attributes. R 1 – R 2 = { t | t 2 R 1 and t R 2 }

8 ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de8 Set difference, example AB ® 1 ® 2 ¯ 1 AB ® 1 ¯ 1 AB ® 2 ¯ 3 R1R1 R2R2 R 1 - R 2

9 ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de9 SQL SQL is based on set and relational operations with certain modifications and enhancements A typical SQL query has the form: select a_1, …, a_n from R_1, …, R_m where P This query is equivalent to relational algebra expression: ¼ a 1,…, a n ( ¾ P (R 1 £ … £ R m )) The result of an SQL query is a relation. Exceptions?

10 ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de10 Integrity constraints Domain constraints. Key constraints. Foreign key constraints. More general, defined constraints.

11 ISWeb - Information Systems & Semantic Web Steffen Staab staab@uni-koblenz.de11 Query language Allow one to define: Relation and database schemas; Relations through our relations; Integrity constraints; Updates.


Download ppt "Information Systems & Semantic Web University of Koblenz Landau, Germany Advanced Data Modeling Relational Data Model continued Steffen Staab with Simon."

Similar presentations


Ads by Google