2 views

PDF

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.

Document Description

1.2. Data models A data model is a model that describes in an abstract way how data are represented in a business organization, an information system or a database management system - Wikipedia

Document Share

Document Transcript

1.2. Data models A data model is a model that describes in an abstract way how data are represented in a business organization, an information system or a database management system - Wikipedia Introduction Relational model Abstract operations on relations Set theoretic operations Relational-specific operations Basic algebra operations Union, Intersection, Difference Cross product Relational model Table as relation Row as tuple real world entity or relationship fact Column as attribute Domain The concept of a relation is abstract, therefore we have a number of different ways of visualising it Relation Relation schema R(A 1, A 2, A 3.. A n ) Design side Assertion/declaration Relation state Data side set of n-tuples each one an ordered list of values 1NF: each value is atomic, no composite/multivalue Abstract operations Database lifecycle design, populate, evolve Insert tuple (a 1,a 2,a 3 a n ) Delete tuple (a 1,a 2,a 3 a n ) Update (or modify) tuple (a 1,a 2,a 3 a n ) attribute to change, new value All the operations described in the next few sections are abstract. We're going to see how valuable they can be in processing real world data later Basic algebra Two categories Set theoretic operations Union, Intersection etc. Relational specific Select, project and join At this stage we're talking about set theoretical operators on the Relational model, not SQL instructions which confusingly have identical names and only similar behaviour Select operation SELECT a subset of tuples from a relation Uses selection condition Evaluate each tuple to true of false False tuples discarded Sigma (s) output = s (cond) (input_relation) Relation schema: R(output) = R(input_relation) Commutative Project operation PROJECT a subset of attributes for all tuples from a relation Pi (p) p attribute list (R) If sublist is only non-key attributes might get duplicates Removes duplicates Attribute list:sublist example The result set of the operation is itself a relational. That output relation will contain the same number of rows as the input, however it may contain a different number of columns; fewer if a subset of attributes is projected; more if derived or aggregated attributes are included Sequences of operations Select followed by projection Area clipping: rows then columns p attr list (s (select_cond) (R)) Rename operation (r) Renames attributes list2 from list1 r (new_attr_names) (R) Rename operation Attribute renaming only Cannot alter domain, or add/remove attr Rename operation (r) Renames attributes list2 from list1 r (new_attr_names) (R) Implicit renaming Order dictated by relational schema Set Theoretic Binary operation: two relations Sets of tuples Union compatibility (same attributes) Union (R u S) Intersection (R n S) Commutative (R u (S u T) = (R u S) u T) Set difference Non-commutative (R-S!= S-R) Cross product Cartesian product of two relations R x S Also known as Cross product Cross join Cross product diagram Introduction to complexity Computationally explosive Relational algebra/model notation Relational schema R(A 1, A 2,,A n ) Relation state r or r(r) Set of unordered tuples r = {t 1, t 2,,t n } Each n-tuple is an ordered list of values t = v 1, v 2,,v n i th value in t = v i called t[a i ] r(r) subset of (dom(a 1 ) x dom(a 2 )... x dom(a n )) Constraints Domain constraint For all v in t of r(r) v i is an element of dom(a i ) Entity constraint K = SK min t[k]!= null Key constraint Superkey SK as identifying subset of attributes t 1 [SK]!= t 2 [SK] Referential integrity Given two relations R 1 and R 2 R 1 contains a foreign key (FK) that references A primary key (PK) in R 2 R 1 referencing relation, R 2 referenced relation Shared domains: dom(fk) = dom(pk) Foreign exists: t 1 in r(r 1 ), t 2 in r(r 2 ) t 1 [FK] = t 2 [PK] NULL

Similar documents

Search Related

Relational Model1.2.4-Triazoles, 4-Thiazolidones, Biologicall1 2. Lab - Researching Converged Network ServGenesis 1-2Photoexcitation study of the 4s (2)S(1/2) staA History of the World In 10.1/2 Chapters by Data Model for Distributed Hydrologic Models(1) Advanced nursing practice (2) Children's Econometrics Models - Panel DataSOLUTIONS MANUAL Introduction to Algorithms 2

We Need Your Support

Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks