MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj RM/SQL Lecture 1 ©Akhilesh Bajaj, 2000, 2002, 2003, 2004. All.

Slides:



Advertisements
Similar presentations
IS698: Database Management Min Song IS NJIT. The Relational Data Model.
Advertisements

Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
Feb 4: Recap of Jan 30 class Data Models: E-R and Relational (and some others of mostly historical interest) We examined the E-R model –Entities, Relationships,
1 Relational Algebra & Calculus. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 28 Database Systems I The Relational Data Model.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 52 Database Systems I Relational Algebra.
1 Relational Model. 2 Relational Database: Definitions  Relational database: a set of relations  Relation: made up of 2 parts: – Instance : a table,
The Relational Model Lecture 3 Book Chapter 3 Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC) From ER to Relational.
The Relational Model Codd (1970): based on set theory Relational model: represents the database as a collection of relations (a table of values --> file)
July 14, 2015ICS 424: recap1 Relational Database Design: Recap of ICS 324.
Databases Illuminated
Relational Model & Relational Algebra. 2 Relational Model u Terminology of relational model. u How tables are used to represent data. u Connection between.
1 The Relational Data Model, Relational Constraints, and The Relational Algebra.
Chapter 4 The Relational Model.
1 Relational Algebra and Calculus Chapter 4. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.
The Relational Model. Review Why use a DBMS? OS provides RAM and disk.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Database System Concepts, 5 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Relational.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 1 © Akhilesh Bajaj, 2000, 2002, 2003, 2004.
1 The Relational Model By Elena Ciriani CS157A February 19, 2004 Professor Lee.
ICOM 5016 – Introduction to Database Systems Lecture 5b Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
CIS552Relational Model1 Structure of Relational Database Relational Algebra Extended Relational-Algebra-Operations Modification of the Database.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
1 The Relational Model. 2 Why Study the Relational Model? v Most widely used model. – Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. v “Legacy.
FALL 2004CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Relational Data Model Ch. 7.1 – 7.3 John Ortiz Lecture 3Relational Data Model2 Why Study Relational Model?  Most widely used model.  Vendors: IBM,
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ICOM 5016 – Introduction.
Database Concepts. Data :Collection of facts in raw form. Information : Organized and Processed data is information. Database : A Collection of data files.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj RM/SQL Lecture 5 © Akhilesh Bajaj, 2000, 2002, 2003, All.
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra)
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Announcements Reading for Monday –4.6 Homework 3 – Due 9/29.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj RM/SQL Lecture 3 © Akhilesh Bajaj, 2000, 2002, All Rights.
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
Database Management Systems, R. Ramakrishnan1 Relational Algebra Module 3, Lecture 1.
Presented By: Miss N. Nembhard. Relation Algebra Relational Algebra is : the formal description of how a relational database operates the mathematics.
Relational Data Model DeSiaMore Powered by DeSiaMore.
MIS 3053 Database Design And Applications The University Of Tulsa Professor: Akhilesh Bajaj Normal Forms Lecture 1 © Akhilesh Bajaj, 2000, 2002, 2003.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj RM/SQL Lecture 4 © Akhilesh Bajaj, 2000, 2002, 2004, All.
SE305 Database System Technology 25/09/2014 Quiz-1.
MIS3053 Database Design And Applications The University Of Tulsa Professor: Akhilesh Bajaj Normal Forms Lecture 2 © Akhilesh Bajaj, 2000, 2002, 2003,2004.
CSCI 6315 Applied Database Systems Review for Midterm Exam I Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A.
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
Chapter 3 The Relational Model. Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. “Legacy.
PMIT-6102 Advanced Database Systems By- Jesmin Akhter Assistant Professor, IIT, Jahangirnagar University.
1 CS122A: Introduction to Data Management Lecture #4 (E-R  Relational Translation) Instructor: Chen Li.
1 Relational Algebra and SQL. 2 Relational Query Languages Languages for describing queries on a relational database Relational AlgebraRelational Algebra.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Module 2: Intro to Relational Model
Relational Model By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany)
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Database.
The Relational Model Textbook /7/2018.
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Example of a Relation attributes (or columns) tuples (or rows)
Chapter 2: Intro to Relational Model
INSTRUCTOR: MRS T.G. ZHOU
Relational Model B.Ramamurthy 5/28/2019 B.Ramamurthy.
Presentation transcript:

MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj RM/SQL Lecture 1 ©Akhilesh Bajaj, 2000, 2002, 2003, All rights reserved.

Goals for Today Learn the basics of the relational model Learn the notions of superkeys, candidate keys and primary keys Get started with relational algebra - Basics of relational algebra - The select operation -The project operation -The assignment operation

What is a Data Model? It is a collection of conceptual tools for describing data, data relationships, data semantics and consistency constraints. Essentially answers the following questions: - What is data? - How are the data related to each other? - How can we query the data and change it? - How do we ensure that the data represents a correct view of the real world (data integrity)? Examples of data models include the relational model, the ER model, the network model and the hierarchical model. The network and hierarchical models are found on older mainframe systems (usually in large organizations).

Basics of the Relational Model Primary model used today for data-processing applications Database systems like Oracle, Sybase, Informix, etc. support this model. Has strong theory associated with it. Proposed in and became mainstream in the early 1980-s onwards. Still the most robust model out there, many experts predict it will be around for tens of years more.

Basics of the Relational Model A database represents information about the enterprise. Information is structured, so as to be easy to store, retrieve and modify. In the relational model, the information is structured by means of a relational schema. A relational schema consists of the table names (also called relation names), the column names (or attribute names), the primary keys of each table and a few more objects we will study. In the ER module, we learnt how to capture user requirements in the ER model, and to map this to a simple relational schema.

Basics of the Relational Model Example of a relational schema: PROFESSORS(fac_id, f_name, research_interest) COURSES(c_num, c_name, num_credits) TEACH(fac_id, c-num) Once we have a schema, the actual information is stored in the form of rows (tuples). Each row represents a “piece” or record of information that represents a part of the real world. Example of rows: PROFESSORS Fac_idF_nameResearch_interest 1Akhilesh Bajaj Information Systems 2 Sudha RamDatabase Modeling Rows or records or tuples Important A table can never have duplicate rows.

Basics of the Relational Model Each attribute in a table has a domain. The domain is the set of values that the attribute can take. This is analogous to domains in the ER model. An attribute can have only one value at a time in a row, and the value is atomic (cannot be further broken up). It is possible for attributes to have a null value, provided they are not part of the primary key of the table. Null can mean one of two things, we don’t know which. E.g., a dependent value being null could mean that there are no dependents, OR that there are dependents but we don’t have information on them.

Superkeys, Candidate Keys, Primary Keys A superkey is any set of attributes in a table, such that no 2 rows can have the same values when we consider all the attributes in the superkey together. E.g., (s_id, name, address, GPA, age), (s_id, name), (s_id, address), (s_id, GPA) are all sets of attributes that are examples of superkeys for the table STUDENTS. A candidate key is a superkey of a table such that no subset of these attributes is also a superkey. E.g., (s_id) is a candidate key of STUDENTS. A table can have several superkeys and more than one of these may be candidate keys. A primary key is selected from these candidate keys. Usually, if the table represents real-world objects, we designate an id as a primary key.

Superkeys, Candidate Keys, Primary Keys All possible attribute sets of a table T All possible superkeys of a table T All possible candidate keys of a table T One set of attributes that make up the primary key of table T

Basics of Relational Algebra Relational algebra is the query language of the relational model. Recall that in a data model, we need to be able to ask questions of the data also. We did not cover this in the ER model. Query languages are procedural or non-procedural. In a procedural language, the user instructs the database system to perform a series of steps. Relational Algebra is procedural. In a non-procedural language, the user describes the information desired, without giving a specific procedure for obtaining that information. SQL is non procedural.

Basics of Relational Algebra The fundamental operations in relational algebra are: - Select -Project -Assign -Union - Set Difference - Cartesian Product - Rename [There are other operations as well.] In relational algebra, the input to an operation is one or two relations (or tables), and the output of an operation is one relation. Select, project, rename are unary operators (input is one table) Union, set difference, cartesian product are binary operators (input is two tables).

The Select Operation Operator: SELECT or Works on: One table Semantics: End result is the set of rows from the table that satisfy a given condition. Condition: based on some attribute values and >,<, =, <>, >=, <=, AND, OR, NOT. E.g., name=“Akhilesh” AND research_interest = “MIS” is a condition. Syntax: SELECT CONDITION ( INPUT_TABLE) The above expression yields an output table whose rows satisfy the condition. The columns remain the same. E.g., PROFESSORS

The Project Operation Operator: PROJECT or Works on: One table Semantics: End result is the set of columns from the table that are specified. Column Specification: column-name1, column-name2, …. Syntax: PROJECT COLUMN_NAMES ( INPUT_TABLE) The above expression yields an output table that contains only the columns that are specified. E.g., PROJECT f_name (PROFESSORS) yields as output a table with only one column: f_name. Has 3 columns 

The Assignment Operation Operator: ASSIGN or Works on: Two tables Semantics: The relational algebra expression on the right is assigned to the table on the left (usually a temporary table). This allows us to write an expression as a sequence of assignments. Syntax: temp_table1 Relational Algebra Expression E.g., temp1 PROJECT f_name (PROFESSORS) assigns the expression on the right to temp1.