Relational Model Ashima Wadhwa What is Relational Model











- Slides: 11
Relational Model Ashima Wadhwa
What is Relational Model? u u Relational model is most widely used data model for commercial data-processing. The reason it’s used so much is, because it’s simple and easy to maintain. The model is based on a collection of tables. Users of the database can create tables, insert new tables or modify existing tables. There are several languages for database programming. • SQL, Oracle, etc.
History of Relational Modeling Introduced by Ted Codd in 1970 u Ted Codd was an IBM Researcher u Laid the foundation for database theory u Many database concepts & products based on his model u
Relational Model Basic The relational model gives us a single way to represent data: as a twodimensional table called a relation. u Attributes u Schemas u Tuples u Domains
Attributes of a relation serve as names for the columns of the relation. Usually, an attribute describes the meaning of entries in the column below. Table = relation. Column headers = attributes. Attribute Title Star Wars Year 1977 Length 124 Might Ducks Wayne’s World 1991 1992 104 95
Schemas u u u The name of a relation and the set of attributes for a relation is called a schema. We show the schema for the relation with the relation name followed by a parenthesized list of its attributes. Relation schema = name(attributes) + other structure info. , e. g. , keys, other constraints. Order of attributes is arbitrary, but in practice we need to assume the (standard) order given in the relation schema. Relational database schema = collection of relation schemas. So the schema for previous slide is Movies (title, year, length)
Database Schema u Data. Base Schema • Logical View of the Database u Database Instance • A view of data in database at anytime. u Relation Schema • Corresponds to the programming language concept of type definition • E. g. Java u u String movie = “Spiderman”; Relation Instance • Corresponds to the programming-language concept of the value of a variable • E. g. Java u String movie = “Spiderman”;
Tuples u The rows of a relation, other than the header row containing The attribute names are called tuples. u A tuple has one component for each attribute of the relation. Title Star Wars Tuple Year 1977 Might Ducks 1991 Wayne’s 1992 World Length 124 104 95
Domains u u u Each attribute of a relation is associated with a particular elementary type called domain. The components of any tuple of the relation must have, in each component, a value that belongs to the domain of the corresponding column. Example: • with title string is associated • with year integer is associated
From Entity Sets to Relations u u An entity set that is not weak, is translated into a relation with the same name and attributes. E. g. , Movie(title, year, length, film. Type) Star(name, address) or Star(name, street, city) Owns Studios name address title Movies year Stars-in length film. Type name address
Queries? ? ?