CS Database Management Systems

Similar documents
Relational Databases

ER modelling, Weak Entities, Class Hierarchies, Aggregation

3. Relational Model and Relational Algebra

The Relational Data Model: Structure

Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys

Relational Algebra. Module 3, Lecture 1. Database Management Systems, R. Ramakrishnan 1

The Relational Model. Why Study the Relational Model? Relational Database: Definitions

LiTH, Tekniska högskolan vid Linköpings universitet 1(7) IDA, Institutionen för datavetenskap Juha Takkinen

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model

Relational model. Relational model - practice. Relational Database Definitions 9/27/11. Relational model. Relational Database: Terminology

Database Design. Database Design I: The Entity-Relationship Model. Entity Type (con t) Chapter 4. Entity: an object that is involved in the enterprise

Chapter 2: Entity-Relationship Model. Entity Sets. " Example: specific person, company, event, plant

Database Design and Normalization

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. The Relational Model. The relational model

Relational Algebra. Basic Operations Algebra of Bags

Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model

The Relational Data Model and Relational Database Constraints

We know how to query a database using SQL. A set of tables and their schemas are given Data are properly loaded

CS 377 Database Systems. Database Design Theory and Normalization. Li Xiong Department of Mathematics and Computer Science Emory University

DATABASE DESIGN. - Developing database and information systems is performed using a development lifecycle, which consists of a series of steps.

Relational Algebra and SQL

Database Management Systems. Chapter 1

not necessarily strictly sequential feedback loops exist, i.e. may need to revisit earlier stages during a later stage

Theory of Relational Database Design and Normalization

Chapter 2: Entity-Relationship Model. E-R R Diagrams

DATABASE MANAGEMENT SYSTEMS. Question Bank:

Database Management Systems

Database Design Methodology

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

Chapter 2: Entity-Relationship Model

The Relational Model. Why Study the Relational Model? Relational Database: Definitions. Chapter 3

Relational Foundations for Functorial Data Migration

Databases What the Specification Says

CS143 Notes: Normalization Theory

Chapter 10 Functional Dependencies and Normalization for Relational Databases

CSC 742 Database Management Systems

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries

Foundations of Query Languages

Data Modeling. Database Systems: The Complete Book Ch ,

Oracle Database 11g: SQL Tuning Workshop

BCA. Database Management System

IT2304: Database Systems 1 (DBS 1)

Databaser den relationelle model

Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

Entity-Relationship Model

Limitations of E-R Designs. Relational Normalization Theory. Redundancy and Other Problems. Redundancy. Anomalies. Example

IT2305 Database Systems I (Compulsory)

Review Entity-Relationship Diagrams and the Relational Model. Data Models. Review. Why Study the Relational Model? Steps in Database Design

Announcements. SQL is hot! Facebook. Goal. Database Design Process. IT420: Database Management and Organization. Normalization (Chapter 3)

Fundamentals of Database System

Conceptual Design Using the Entity-Relationship (ER) Model

The Entity-Relationship Model

Introduction to database design

Lesson 8: Introduction to Databases E-R Data Modeling

ENTITY-ANALYSIS AND VIEW-INTEGRATION DATABASE DESIGN METHODOLOGIES: A COMPARATIVE STUDY

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E)

Relational Databases. Christopher Simpkins


Chapter 13: Query Processing. Basic Steps in Query Processing

The SQL Query Language. Creating Relations in SQL. Referential Integrity in SQL. Basic SQL Query. Primary and Candidate Keys in SQL

EXAMINATIONS OF THE HONG KONG STATISTICAL SOCIETY

Normal Form vs. Non-First Normal Form

Relational Algebra 2. Chapter 5.2 V3.0. Napier University Dr Gordon Russell

Converting E-R Diagrams to Relational Model. Winter Lecture 17

Chapter 8 The Enhanced Entity- Relationship (EER) Model

SUBQUERIES AND VIEWS. CS121: Introduction to Relational Database Systems Fall 2015 Lecture 6

Concepts of Database Management Seventh Edition. Chapter 6 Database Design 2: Design Method

How To Manage Data In A Database System

Secure Sharing of Electronic Health Records in Clouds

Fast Contextual Preference Scoring of Database Tuples

Chapter 14: Query Optimization

Database IST400/600. Jian Qin. A collection of data? A computer system? Everything you collected for your group project?

Course: CSC 222 Database Design and Management I (3 credits Compulsory)


Chapter 10. Functional Dependencies and Normalization for Relational Databases

CS411 Database Systems

The Entity-Relationship Model

City University of Hong Kong. Information on a Course offered by Department of Computer Science with effect from Semester A in 2014 / 2015

Outline. Data Modeling. Conceptual Design. ER Model Basics: Entities. ER Model Basics: Relationships. Ternary Relationships. Yanlei Diao UMass Amherst

4. SQL. Contents. Example Database. CUSTOMERS(FName, LName, CAddress, Account) PRODUCTS(Prodname, Category) SUPPLIERS(SName, SAddress, Chain)

MOC 20461C: Querying Microsoft SQL Server. Course Overview

Chapter 6: Integrity Constraints

Database Design. Goal: specification of database schema Methodology: E-R Model is viewed as a set of

Theory of Relational Database Design and Normalization

There are four technologies or components in the database system that affect database performance:

Database Fundamentals: 1

? Database Management

Lecture 6. SQL, Logical DB Design

2 Associating Facts with Time

SQL NULL s, Constraints, Triggers

Database Design Methodology

Chapter 7: Relational Database Design

A. TRUE-FALSE: GROUP 2 PRACTICE EXAMPLES FOR THE REVIEW QUIZ:

Database Design and Normalization

8 9 +

Testing LTL Formula Translation into Büchi Automata

TraMOOC Project Overview Presentation. Overview Presentation

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL

Relational Database Design: FD s & BCNF

XV. The Entity-Relationship Model

Transcription:

CS 344 - Database Management Systems Lecture Notes 12/09/2011 Real World Problem E R Modeling Relational Model Q. Why it takes two steps to convert a real world problem to relational model? Ans. Because ER Modeling is more intuitive and using ER modeling it is easy to analyze the relations among entity sets. ER Model: The entity-relationship (ER) data model allows us to describe the data involved in a real-world enterprise in terms of objects and their relationships and is widely used to develop an initial database design. As the name suggests entity relationship model deals with entities and the relationships between them so defining the terms. Entity Sets It is the set of entities of similar type and entity is any object in the real world distinguishable from other objects. For Example In a book store all books from the same publisher is an entity set while a particular book is an entity.

Putting all the similar entities altogether makes job easy for programmer and also it is scalable. Attributes An entity is described using a set of attributes. All entities in a given entity set have the same attributes. Attributes are of various types as follows. Simple Attribute: Atomic value. Means can t be further divided. Ex Age, Color Composite Attribute: Can be further divisible. Ex Roll Number of IITG student, Date of Birth, Course Name in IITG Multi Valued Attribute: Attribute that can have multiple values of same type. Ex phone number, Account Number, Pat Name. Derived Attribute: The value of attribute can be derived from the value of other attribute. Ex. Age from the DOB, Country from IP, place from PINCODE. ** There may be some examples which can t be represented using any of the above attribute. eg Video frames. Q. Why do we require Derived Attributes? Ans. Because Using derived attribute we can find the required value. We don t have to specifically store the other attribute separate in the table so it reduces the storage. Weak Entity Sets and Strong Entity Sets: Weak entity sets are those which can t generate primary key on their own. While Strong entity sets have their primary keys. Relationship Sets: A relationship gives the association between two or more entities. Grouping all similar relations what we get is a relationship set. Relationships have descriptive attributes i.e. they give additional information like if the leave date and duration is known then joining date can be estimated. There are four types of relationships as follows. One to One Many to One Many to Many One to Many

Specialization: An entity set may include subgroups of entities within it which are distinct in some way from other entities. The process of designating subgroupings within an entity set is called Specialization. Generalization: Similar to the above, two specialized entity set can be represented as a super entity having the similar characteristics as the specialized entity sets. Ex: STUDENT Generalization IS A B.TECH Specialization M.TECH Specialization Aggregation: Its an abstraction through which relationships are treated as higher level entities.

Relational Model: The Relational data model consists of a collection of tables, each of which is assigned a unique name. A row in a table represents a relationship among a set of values. Informally, a table is an entity set and a row is an entity. Database Schema: It s the logical design of the database. Keys: Super Key: A super key is a set of one or more attributes that, taken collectively, allows us to indentify uniquely a tuple in the relation. Candidate Key: Minimal superkeys are called Candidate Keys. Primary Key: Key chosen by the database designer as the principle means of identifying tuples within a relation. Relational-Algebra Operations: Select: The select operation selects tuples that satisfy a given predicate. We use Greek letter sigma ( σ ) to denote selection operation. Project: The project operation allows to select only a particular set of attributes. We use Geek letter pi ( π ) to denote projection operation. Union: The union operation is used to merge two relations. It is denoted by ( U ) For two relations r and s, for r U s to be valid, we require that: The relations r and s must be having the same number of attributes The domains of the ith attribute of r and the ith attribute of s must be the same, for all i. Set-Difference: The set-difference operation, denoted by minus sign ( - ), allows us to find tuples that are in one relation but are not in another. Cartesian-Product: It allows us to combine information from any two relations. It is denoted by cross ( X )

Rename: This lets us rename a relation to an another name. It is denoted by Greek letter rho ( ρ ). To rename a relation/expression E as X, we write it as ρ x (E) Additional Relational-Algebra Operations: Set-Intersection: This operation is used to select the tuples from two relations which are common to both. Set-Intersection operation is denoted by ( ) Natural-Join: Consider two relations r(r) and s(s). The natural join of two relations r and s, denoted by ( ), is a relation on schema R U S formally defined as follows: r s = π RUS (σ r.a1 = s.a1 r.a2 = s.a2 r.an = s.an (r X s) ) Division: Let r( R ) and s( S ) be relations, and let S R; i.e, every attribute of schema S is also in schema R. The relation r s is a relation on schma R S ( i.e, on the schema containing all attributes of schema R that are not in schema S ). A tuple t is in r s iff both of two conditions hold: t is in π R-S (r) For every tuple t s in s, there is a tuple t r in r satisfying both of the following: o o t r [S] = t s [S] t r [R S] = t Alternatively, r s = π R-S ( r ) - π R-S ( ( π R-S ( r ) X s ) - π R-S,S ( r ) ) Left outer Join: This operation, denoted by ( ) takes all tuples in the left relation that did not match with any tuple in the right relation, pads the tuples with null values for all other attributes from the right relation and adds them to the result of the natural join. Right outer join: This operation, denoted by ( ) is symmetric with the left outer join: It pads tuples from the right relation that did not match any from the left relation with nulls and adds them to the result of the natural join.