 Database – collection of persistent data  Database Management System (DBMS) – software system that supports creation, population, and querying of a.

Slides:



Advertisements
Similar presentations
Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
Advertisements

Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
The Relational Model. Introduction Introduced by Ted Codd at IBM Research in 1970 The relational model represents data in the form of table. Main concept.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
SQL Review.
Database Management Systems 1 Raghu Ramakrishnan The Relational Model Chapter 3 Instructor: Mirsad Hadzikadic.
Introduction to Relational Databases Obtained from Portland State University.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 28 Database Systems I The Relational Data Model.
The Relational Model CS 186, Fall 2006, Lecture 2 R & G, Chap. 3.
SPRING 2004CENG 3521 The Relational Model Chapter 3.
The Relational Model Ramakrishnan & Gehrke, Chap. 3.
1 Query Languages: How to build or interrogate a relational database Structured Query Language (SQL)
The Relational Model CS 186, Spring 2007, Lecture 2 Cow book Section 1.5, Chapter 3 Mary Roth.
1 Relational Model. 2 Relational Database: Definitions  Relational database: a set of relations  Relation: made up of 2 parts: – Instance : a table,
1.1 CAS CS 460/660 Introduction to Database Systems Relational Model and more…
The Relational Model These slides are based on the slides of your text book.
The Relational Model. Review Why use a DBMS? OS provides RAM and disk.
 Relational database: a set of relations.  Relation: made up of 2 parts: › Instance : a table, with rows and columns. #rows = cardinality, #fields =
Database Organization and Design
Introduction to Relational Databases
FALL 2004CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
1.1 CAS CS 460/660 Relational Model. 1.2 Review E/R Model: Entities, relationships, attributes Cardinalities: 1:1, 1:n, m:1, m:n Keys: superkeys, candidate.
1 Database Systems ( 資料庫系統 ) October 4, 2005 Lecture #3.
Constraints CSED421 Database Systems Lab. Constraints To define an integrity constraint (IC) –IC : condition that must be true for any instance of the.
1 Database Systems ( 資料庫系統 ) October 4/5, 2006 Lecture #3.
The Relational Model Content based on Chapter 3 Database Management Systems, (Third Edition), by Raghu Ramakrishnan and Johannes Gehrke. McGraw Hill, 2003.
12/2/2015CPSC , CPSC , Lecture 41 Relational Model.
Database Indexing 1 After this lecture, you should be able to:  Understand why we need database indexing.  Define indexes for your tables in MySQL. 
CMPT 258 Database Systems The Relationship Model (Chapter 3)
The Relational Model Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY.
ICS 421 Spring 2010 Relational Model & Normal Forms Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1/19/20101Lipyeow.
CS34311 The Relational Model. cs34312 Why Relational Model? Currently the most widely used Vendors: Oracle, Microsoft, IBM Older models still used IBM’s.
Database Management Systems.  Instructor: Yrd. Doç. Dr. Cengiz Örencik   Course material.
Faeez, Franz & Syamim.   Database – collection of persistent data  Database Management System (DBMS) – software system that supports creation, population,
Advanced Computing Data Bases: Basic concepts Based in part on open access material from: Database Management Systems by Raghu Ramakrishnan and Johannes.
Chapter 3 The Relational Model. Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. “Legacy.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
Introduction to Databases & SQL Ahmet Sacan. What you’ll need Firefox, SQLite plugin Mirdb and Targetscan databases.
1 CS122A: Introduction to Data Management Lecture #4 (E-R  Relational Translation) Instructor: Chen Li.
Database Management Systems 1 Raghu Ramakrishnan The Relational Model Chapter 3 Instructor: Xin Zhang.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Databases and DBMSs Todd S. Bacastow January
Logical DB Design: ER to Relational
COP Introduction to Database Structures
Storage and Indexes Chapter 8 & 9
These slides are based on the slides of your text book.
CS 186, Fall 2006, Lecture 2 R & G, Chap. 3
Introduction to Relational Databases
Translation of ER-diagram into Relational Schema
Lecture#7: Fun with SQL (Part 2)
CS 405G: Introduction to Database Systems
Instructor: Mohamed Eltabakh
Database Systems (資料庫系統)
The Relational Model Content based on Chapter 3
The Relational Model Chapter 3
The Relational Model Relational Data Model
Relational Databases The Relational Model.
Relational Databases The Relational Model.
CS 405G: Introduction to Database Systems
The Relational Model Chapter 3
Translation of ER-diagram into Relational Schema
The Relational Model The slides for this text are organized into chapters. This lecture covers Chapter 3. Chapter 1: Introduction to Database Systems Chapter.
CMPT 354: Database System I
Database Systems (資料庫系統)
The Relational Model Chapter 3
CS 505: Intermediate Topics to Database Systems
The Relational Model Content based on Chapter 3
The Relational Model Content based on Chapter 3
CS 405G: Introduction to Database Systems
The Relational Model Chapter 3
Presentation transcript:

 Database – collection of persistent data  Database Management System (DBMS) – software system that supports creation, population, and querying of a database

 Relational Database Management System (RDBMS) ◦ Consists of a number of tables and single schema (definition of tables and attributes) ◦ Students (sid, name, login, age, gpa) Students identifies the table sid, name, login, age, gpa identify attributes sid is primary key

 Students (sid: string, name: string, login: string, age: integer, gpa: float) sidnameloginagegpa

 Courses (cid, instructor, quarter, dept) cidinstructorquarterdept Carnatic101JaneFall 06Music Reggae203BobSummer 06Music Topology101MarySpring 06Math History105AliceFall 06History

 Primary key – minimal subset of fields that is unique identifier for a tuple ◦ sid is primary key for Students ◦ cid is primary key for Courses  Foreign key –connections between tables ◦ Courses (cid, instructor, quarter, dept) ◦ Students (sid, name, login, age, gpa) ◦ How do we express which students take each course?

 Courses (cid, instructor, quarter, dept)  Students (sid, name, gpa)  Enrolled (cid, sid, grade)

Select students with gpa higher than 3.3 from S1: sidnamegpa 50000Dave Jones Smith Smith Madayan Guldu2.0 Students sidnamegpa 53666Jones Smith3.8

Project name and gpa of all students in S1 S1 Sidnamegpa 50000Dave Jones Smith Smith Madayan Guldu2.0 namegpa Dave3.3 Jones3.4 Smith3.2 Smith3.8 Madayan1.8 Guldu2.0

 Select name and gpa of students in S1 with gpa higher than 3.3: Sidnamegpa 50000Dave Jones Smith Smith Madayan Guldu2.0 namegpa Jones3.4 Smith3.8

 Combine information from two or more tables  Example: students enrolled in courses: Sidnamegpa 50000Dave Jones Smith Smith Madayan Guldu2.0 cidgradestudid Carnatic101C53831 Reggae203B53832 Topology112A53650 History 105B53666 S1 E

sidnamegpacidgradestudid 53666Jones3.4History105B Smith3.8Topology112A Madayan1.8Carnatic101C Guldu2.0Reggae203B53832 Sidnamegpa 50000Dave Jones Smith Smith Madayan Guldu2.0 cidgradestudid Carnatic101C53831 Reggae203B53832 Topology112A53650 History 105B53666 S1 E

 CREATE TABLE ◦ Create a new table, e.g., students, courses, enrolled  SELECT-FROM-WHERE ◦ List all CS courses  INSERT ◦ Add a new student, course, or enroll a student in a course

 CREATE TABLE Enrolled (studid CHAR(20), cid CHAR(20), grade CHAR(20), PRIMARY KEY (studid, cid), FOREIGN KEY (studid) references Students)

 “Find all students who are under 18” SELECT * FROM Students S WHERE S.age < 18

 “Print the student name and course ID where the student received an ‘A’ in the course” SELECT S.name, E.cid FROM Students S, Enrolled E WHERE S.sid = E.studid AND E.grade = ‘A’

 MIN, MAX, AVG ◦ Find highest grade in fall database course  COUNT, DISTINCT ◦ How many students enrolled in CS courses in the fall?  ORDER BY, GROUP BY ◦ Rank students by their grade in fall database course

 Idea: speed up access to desired data  “Find all students with gpa > 3.3  May need to scan entire table  Index consists of a set of entries pointing to locations of each search key

 Data independence – provides abstract view of the data, without details of storage  Efficient data access – uses techniques to store and retrieve data efficiently  Reduced application development time – many important functions already supported  Centralized data administration  Data Integrity and Security  Concurrency control and recovery