Lecture Notes for 3 rd August Lecture topic : Introduction to Relational Model. Rishi Barua Shubham Tripathi

Similar documents
Chapter 2: Intro to Relational Model

Chapter 2: Intro to Relational Model

Database System Concepts, 5 th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

Chapter 2: Relational Model

Database Technology Introduction. Heiko Paulheim

Chapter 2 Introduction to Relational Models

Chapter 2: Relational Model

2.2.2.Relational Database concept

Relational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity

Chapter 4. The Relational Model

Midterm Review. Winter Lecture 13

Relational Database: The Relational Data Model; Operations on Database Relations

RELATIONAL DATA MODEL

Chapter 3: Relational Model

Relational Model. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan

Chapter 6 The Relational Algebra and Relational Calculus

Introduction to Relational Databases. Introduction to Relational Databases cont: Introduction to Relational Databases cont: Relational Data structure

CMP-3440 Database Systems

CS425 Fall 2016 Boris Glavic Chapter 2: Intro to Relational Model

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity

Database System Concepts

Relational Model, Relational Algebra, and SQL

Relational Algebra. Relational Algebra. 7/4/2017 Md. Golam Moazzam, Dept. of CSE, JU

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

THE RELATIONAL DATABASE MODEL

Comp 5311 Database Management Systems. 2. Relational Model and Algebra

CS34800 Information Systems. The Relational Model Prof. Walid Aref 29 August, 2016

Relational Query Languages. Preliminaries. Formal Relational Query Languages. Example Schema, with table contents. Relational Algebra

CS2300: File Structures and Introduction to Database Systems

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

Relational Data Model ( 관계형데이터모델 )

Relational Model Concepts

Relational Algebra. Procedural language Six basic operators

Faloutsos - Pavlo CMU SCS /615

Overview. Carnegie Mellon Univ. School of Computer Science /615 - DB Applications. Concepts - reminder. History

COSC344 Database Theory and Applications. σ a= c (P) Lecture 3 The Relational Data. Model. π A, COSC344 Lecture 3 1

Chapter 3: The Relational Database Model

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, normal forms. University of Edinburgh - January 25 th, 2016

Relational Algebra. Note: Slides are posted on the class website, protected by a password written on the board

The Relational Model and Relational Algebra

Lecture 11 - Chapter 8 Relational Database Design Part 1

Relational Model and Relational Algebra. Rose-Hulman Institute of Technology Curt Clifton

ECE 650 Systems Programming & Engineering. Spring 2018

Relational Algebra. Mr. Prasad Sawant. MACS College. Mr.Prasad Sawant MACS College Pune

1 Relational Data Model

DATABASE TECHNOLOGY - 1DL124

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

Relational Model and Relational Algebra

Relational Algebra. Lecture 4A Kathleen Durant Northeastern University

Relational Model and Relational Algebra

Relational Algebra and Calculus

Unit- III (Functional dependencies and Normalization, Relational Data Model and Relational Algebra)

The data structures of the relational model Attributes and domains Relation schemas and database schemas

Relational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions.

Database Management System 11

Relational Data Model

CS 377 Database Systems

Informal Design Guidelines for Relational Databases

CSIT5300: Advanced Database Systems

Announcements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes

Chapter 6: Formal Relational Query Languages

Chapter 3. The Relational Model. Database Systems p. 61/569

CS317 File and Database Systems

Chapter 1: Introduction

CS211 Lecture: Database Design

Relational Query Languages: Relational Algebra. Juliana Freire

CIS 330: Applied Database Systems. ER to Relational Relational Algebra

Modeling access. Relational query languages. Queries. Selection σ P (R) Relational model: Relational algebra

Fundamentals of Database Systems

CS317 File and Database Systems

ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION

Textbook: Chapter 6! CS425 Fall 2013 Boris Glavic! Chapter 3: Formal Relational Query. Relational Algebra! Select Operation Example! Select Operation!

Running Example Tables name location

Ian Kenny. November 28, 2017

Database Applications (15-415)

Relational Model & Algebra. Announcements (Thu. Aug. 27) Relational data model. CPS 116 Introduction to Database Systems

CS121 MIDTERM REVIEW. CS121: Relational Databases Fall 2017 Lecture 13

CS 377 Database Systems

Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2

Relational Databases

Basic operators: selection, projection, cross product, union, difference,

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and

Chapter 6: Relational Database Design

QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS

CS530 Database Architecture Models. Database Model. Prof. Ian HORROCKS. Dr. Robert STEVENS. and Design The Relational

II. Structured Query Language (SQL)

Lecture 03. Spring 2018 Borough of Manhattan Community College

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database?

UNIT- II (Relational Data Model & Introduction to SQL)

Set theory is a branch of mathematics that studies sets. Sets are a collection of objects.

Chapter 6 Formal Relational Query Languages

The Basic (Flat) Relational Model. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Unit 3 : Relational Database Design

v Conceptual Design: ER model v Logical Design: ER to relational model v Querying and manipulating data

ARTICLE RELATIONAL ALGEBRA

The Relational Model

COMP 244 DATABASE CONCEPTS AND APPLICATIONS

Chapter 10. Normalization. Chapter Outline. Chapter Outline(contd.)

DATABASE DESIGN I - 1DL300

DC62 Database management system JUNE 2013

Transcription:

Lecture Notes for 3 rd August 2011 Lecture topic : Introduction to Relational Model Rishi Barua 09010141 Shubham Tripathi 09010148

Example of a relation. Attribute (Column) ID Name Department Salary (Rs) 22 Ram Prasad CSE 50000 25 Praveen Kumar CL 45000 The tuple formed by a row is a relationship.

Definitions Domain of the Attribute: The set of permitted values for the attribute. Eg: For the attribute Department Name the set of all department names is the domain. Atomic Domain: A domain is atomic if elements of the domain are considered to be indivisible units. Eg: The set of names is non-atomic if we consider it to have first name,middle name and last name, however age is an atomic unit. Null value: An attribute takes a null value when an entity does not have a value for it. The null value may indicate not applicable that is, that the value does not exist for the entity. For example, one may have no middle name. Null can also designate that an attribute value is unknown. The null value adds complications in the definition of several operations.

Formal Definition of a Relation Let A 1,A 2, A 3, A 4..A n be the attributes of the domain, then a= (A 1,A 2, A 3, A 4..A n ) is called a relation schema. A relation R is a subset of the cartesianproduct D 1 X D 2 X D 3.X D N, where D 1, D 2, D 3.D N are the domain set of the attributes A 1,A 2, A 3, A 4..A n. A relation instance(current values) of a relation is specified by a table. Relations are unordered,i.eorder of tuplesdoes not matter an can be stored in any arbitrary order. Repetition of information and need for null values result in bad design. Normalization theory is used for generating good designs. A database consists of multiple relations.

Keys A superkeyis a set of one or more attributes that, taken collectively, allow us to identify uniquely an entity in the entity set. If K is a superkey, then so is any superset of K. We are often interested in superkeysfor which no proper subset is a superkey. Such minimal superkeysare called candidate keys. The term primary keydenotes a candidate key that is chosen by the database designer as the principal means of identifying entities within an entity set. The primary key should be chosen such that its attributes are never, or very rarely, changed. For instance, the address field of a person should not be part of the primary key, since it is likely to change. The student roll no. or id is an example of a primary key as it is highly unlikely to change and uniquely identifies the student. Foreign key-a foreign key is an attribute of a different entity that is used to identify the current entity. The changes affected on the foreign key in the initial entity set,will automatically be updated in the current entity set. For eg: if the student s department changes it will be updated in every set, where the student s department is a foreign key. It results in a referencing relation and a referenced relation.

QUERY LANGUAGE Query Languages is a language in which a user requests information from the database. They can be categorisedas : Procedural Language Non procedural or Declarative Language 1. In a procedural language the user instructs the system to perform a system of operations on the database to compute the desired results. Eg: Relational Algebra 2. In a non-procedural language the user describes the information desired without giving a specific procedure for obtaining that information. Eg: Tuple Related Calculus 3. Most commercial relational database system offer a query language that includes elements of both the procedural and the non-procedural approaches. Examples of pure languages: Relational Algebra, Tuple Related Calculus, Domain Related Calculus.

Fundamental Operations The Select Operation The select operation selects tuplesthat satisfy a given predicate. We use the σ to denote selection. The predicate appears as a subscript to σ. Eg: σ name = tree,σ loan > 1200 The select operation can also be used to select attibutes(columns), as in Select Name and Roll No. from student table which contains various attributes of the student. Composition of Relational Operations Composing relational algebra operations into relational algebra expessionsis just like composing arithmetic operations (such as +,-,/,*) Union Operation This involves the union of two search tuples.eg: Selecting plants who are either violets or roses. i.e. it combines the two sets of roses and violets. The Cartesian Product Operator The cartesianproduct operation denoted by X allows us to combine information from any two relations. We write the cartesianproduct of relations R 1 and R 2 as R 1 XR 2

Set difference operation It is denoted by -, and allows us to find tuplesthat are in one relation but are not in another. The expression r-s results in a relation containing those tuplesin r but not in s. Additional Operations Set intersection operation It is denoted by П. It is not a fundamental operation and does not ad any power to the relational algebra. r Пs = r ( r s )

Natural Join Operation The natural join is a binary operation that allows us to combine certain selections and the cartesianproduct into one operation. The natural join operation forms a cartesianprductof its two arguments, performs a selection forcing equality on those attributes that appear in both relation schemas and finally removes duplicate attributes. Let rand sbe relations on schemas Rand Srespectively. Then, the natural join of relations Rand Sis a relation on schema R Sobtained as follows: Consider each pair of tuplest r from rand t s from s. If t r and t s have the same value on each of the attributes in R S, add a tuplet to the result, where thas the same value as t r on r thas the same value as t s on s r s Reference : Codd s 12 rules : http://en.wikipedia.org/wiki/codd%27s_12_rules