CS609 Introduction. Databases Current state? Future?

Slides:



Advertisements
Similar presentations
Implementation of the Relational Model
Advertisements

The Relational Model and Relational Algebra Nothing is so practical as a good theory Kurt Lewin, 1945.
Foundations of Relational Implementation n Defining Relational Data n Relational Data Manipulation n Relational Algebra.
Structure Query Language (SQL) COMSATS INSTITUTE OF INFORMATION TECHNOLOGY, VEHARI.
Midterm Review Lecture 14b. 14 Lectures So Far 1.Introduction 2.The Relational Model 3.Disks and Files 4.Relational Algebra 5.File Org, Indexes 6.Relational.
Database Systems Chapter 6 ITM Relational Algebra The basic set of operations for the relational model is the relational algebra. –enable the specification.
Lesson II The Relational Model © Pearson Education Limited 1995, 2005.
YV - Relational Model and Algebra 110 Κεφάλαιο 3 ΣΧΕΣΙΑΚΟ ΜΟΝΤΕΛΟ.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
Database Systems: A Practical Approach to Design, Implementation and Management International Computer Science S. Carolyn Begg, Thomas Connolly Lecture.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 7 Introduction to Structured Query Language (SQL)
The Relational Model Codd (1970): based on set theory Relational model: represents the database as a collection of relations (a table of values --> file)
Database Architecture The Relational Database Model.
Databases Illuminated
Relational Algebra.  Introduction  Relational Algebra Operations  Projection and Selection  Set Operations  Joins  Division  Tuple Relational Calculus.
Concepts of Database Management, Fifth Edition
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 3 Section 3.4 Relational Database Operators
FEN  Concepts and terminology  Operations (relational algebra)  Integrity constraints The relational model.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
1 CS 430 Database Theory Winter 2005 Lecture 12: SQL DML - SELECT.
SQL Chapters 4, 5 (ed. 7 Chaps. 6,7). SQL or SEQUEL (Structured English Query Language) Based on relational algebra First called ‘Square’ Developed in.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Relational Algebra - Chapter (7th ed )
CSE314 Database Systems The Relational Algebra and Relational Calculus Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
1 The Relational Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
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.
Oracle DML Dr. Bernard Chen Ph.D. University of Central Arkansas.
FEN Introduction to the database field:  The Relational Model Seminar: Introduction to relational databases.
Relational Algebra – Part 2
1.1 CAS CS 460/660 Introduction to Database Systems Relational Algebra.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
IS 230Lecture 6Slide 1 Lecture 7 Advanced SQL Introduction to Database Systems IS 230 This is the instructor’s notes and student has to read the textbook.
SQL Chapter 8. SQL or SEQUEL - (Structured English Query Language) Based on relational algebra Developed in 1970's released in early 1980's Standardized.
Chapter 5 Relational Algebra and Relational Calculus Pearson Education © 2009.
Implementation of the Relational Model There is no substitute for the comfort supplied by the utterly taken-for-granted relationship. Iris Murdoch.
SQL LANGUAGE and Relational Data Model TUTORIAL Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
Advanced Relational Algebra & SQL (Part1 )
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
1/18/00CSE 711 data mining1 What is SQL? Query language for structural databases (esp. RDB) Structured Query Language Originated from Sequel 2 by Chamberlin.
Relational Model E.F. Codd at IBM 1970 Chapter 3 (ed. 7 – Chap. 5)
Slide 6- 1 Additional Relational Operations Aggregate Functions and Grouping A type of request that cannot be expressed in the basic relational algebra.
Presented By: Miss N. Nembhard. Relation Algebra Relational Algebra is : the formal description of how a relational database operates the mathematics.
1 CS 430 Database Theory Winter 2005 Lecture 5: Relational Algebra.
CSC271 Database Systems Lecture # 7. Summary: Previous Lecture  Relational keys  Integrity constraints  Views.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Query Processing – Implementing Set Operations and Joins Chap. 19.
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
LECTURE THREE RELATIONAL ALGEBRA 11. Objectives  Meaning of the term relational completeness.  How to form queries in relational algebra. 22Relational.
Relational Algebra COMP3211 Advanced Databases Nicholas Gibbins
Ritu CHaturvedi Some figures are adapted from T. COnnolly
Chapter (6) The Relational Algebra and Relational Calculus Objectives
COMP3017 Advanced Databases
Chapter # 6 The Relational Algebra and Calculus
Relational Model By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany)
CS580 Advanced Database Topics
SQL: Advanced Options, Updates and Views Lecturer: Dr Pavle Mogin
The Relational Algebra and Relational Calculus
Chapter # 7 Introduction to Structured Query Language (SQL) Part II.
The Relational Model Textbook /7/2018.
Unit Relational Algebra 1
Presentation transcript:

CS609 Introduction

Databases Current state? Future?

Relational Model (1970 E.F. Codd) - Chapters 2-3 A data model: types relationships constraints basic operations relational model - files + mathematical foundation (set theory) Relation - Table Rows - Tuples Attributes - Columns

Relational Rules 1. 1NF 2. Access rows by content only (can't say 3rd row), unique rows 3. Integrity constraints key constraints (all tuples distinct) entity constraints - no primary key null domain constraint - defines domain values referential constraint - if a tuple refers to another tuple, it must be an existing tuples semantic constraint - defines rules for relationships

Notation Relational algebra (algebraic notation) and relational calculus - logical notation –used to demonstrate potential for query language of relational DB –algebra and calculus equivalent in expressive power

Operations Set theoretic ops: – union, intersection, difference, cartesian product Native relational ops: –project, select, division, join - equi, theta, natural join –R / S - result is those rows t such that for every row s in S, if concatenate t and s, can be found in R Other ops –outer joins - left, right, aggregate (set) functions, grouping

Operations cont’d Precedence of relational algebra ops: (in order of highest) –Project –Select –cartesian product –join & divide –Minus –Union –intersection

Complete Set Can express any query (except aggregate functions) with the complete set –Select  –Project  –Cartesian product X –Union U –Difference - R/S = R - ((R X S) - R) given R(A1...An,B1...Bm) S(B1...Bm) (  A1...An R) -  A1...An ((  A1...An R X S) - R) R ^ S = (RUS)-((R-S) U (S-R))

Query Language SQL or SEQUEL - (Structured English Query Language) High-level DB language created at IBM in 1970's DB system products using SQL released in early 80's Provides DML and DDL Standard SQL –SQL-86, SQL-89 - minimal standard, still incompatibility product features –ANSI/ISO - (SQL-92) SQL2 - tried to avoid incompatibility problems –X/Open standard - extensions plus portability –SQL-3 –Current standard SQL:1999, SQL-99 –Future standard SQL:2003, SQL:200n

SQL Subselect - formal definition: Select expr {, expr} From tablename [alias] {, tablename [alias]} [Where search_condition] [Group By col {, col}] [Having search_condition] Full Select - formal definition: Subselect {Union [all] subselect} [Order By result_col [asc | desc] {, result_col [asc | desc]}] west.oracle.com/docs/cd/A91202_01/901_doc/server.901/a90125/statemen ts_103.htm#

Sample SQL queries List the ssn for each female employee and pname of projects she works_on. List the ssn and salary for all employees who do not have a son as a dependent. List lname, fname of employees who have more than 2 dependents. List lname, pname, plocation for all projects worked on by f employees with > 2 dependents. List employee ssn and salary (with 10% increase) for all employees who do not work on project # 30. Give every employee a 10% raise.

Power/Weakness of SQL SQL is a non-procedural language – user specifies what is desired rather than how (e.g. no need to write loop statement to traverse tuples) –no implied ordering –query optimizer decides how –desired result described in one statement –Avoids procedural complexities –A language with the power of relational algebra defined as relationally complete (Codd)

Weakness of SQL 1) Too many equivalent forms –e.g. in, =any, exists not in, <> all 2) No non-procedural language can have Turing power (computational complete), e.g. perform any computational procedure that can be specified in algorithmic terms –Not true of SQL only relationally complete

Weakness 3) Some capabilities missing –Selects cannot be arbitrarily nested like relational algebra –loss of expressive power of a relational algebra expression 4) Cannot nest set functions –e.g. Average of total dollar sales 5) No statistical functions (besides avg) –e.g. variance, mode

Weakness 6 ) Can find reports SQL can't create - need embedded SQL –e.g. categorize total sales based on size of sale 7) No Transitive closure - arbitrary number – managers of managers 8) Limited by Boolean conditions –Cannot retrieve 5 out of 6 –Cannot list 20 agents with largest sales –No distance to keywords Are 1-8 still true of ORACLE?

Strengths While selects cannot be arbitrarily nested - have added power in search (where) condition Other strengths of SQL?