• UNIT II Introduction to the Relational Model • Integrity Constraint Over relations • Enforcing Integrity constraints • Querying relational data • Logical data base Design • Introduction to Views • Destroying /altering Tables and Views. • Relational Algebra • Selection and projection set operations • renaming – Joins – Division • Examples of Algebra overviews • Relational calculus • Tuple relational Calculus • Domain relational calculus • Expressive Power of Algebra and calculus.
Relational Model •Relations: The main construct for representing the data in the relational model is a relation. •A relation consists of a relation schema and relation instance. Relation Schema : specifies name of relation, plus name of each field( or column. or attribute, or property) and the domain of each field. A domain is referred to in a relation schema by the domain name, and has a set of associated values. E.g. Students(sid: string, name: string, login: string, age: integer, gpa: real) #fields = degree / arity •An Instance of a relation is a set of tuples, also called records or rows, in which each tuple has the same number of fields as the relation schema. Cardinality=#rows. 3
sid name 53666 Jones 53688 53650 login age gpa jones @c s 18 3.4 Smith smith@e ecs 18 3.2 Smith smith @math 19 3.8 • Cardinality = 3, arity = 5 , all rows distinct A relational database is a collection of relations with distinct relation names. The relational database schema is the collection of schemas for the relations in the database An instance of a relational database is a collection of relation instances, one per relation schema in the database schema Creating and modifying relations using SQL 1. 2. 3. 4. Create Insert Update Delete 4