Programming and SQL Edel Sherratt. Motivation 1: Integrity Checking Sometimes primary keys and foreign keys are not enough For example, they do not enforce.

Slides:



Advertisements
Similar presentations
DB glossary (focus on typical SQL RDBMS, not XQuery or SPARQL)
Advertisements

POSTGRESQL DUNGEON WITH TABLE INHERITANCE AND CONSTRAINTS Edel Sherratt.
Chapter 8 Advanced SQL Pearson Education © Chapter 8 - Objectives u How to use the SQL programming language u How to use SQL cursors u How to create.
PL/SQL. Introduction to PL/SQL PL/SQL is the procedure extension to Oracle SQL. It is used to access an Oracle database from various environments (e.g.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
SQL: Standards and Flavors A presentation for CS157B by David Wortham.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 28 Database Systems I The Relational Data Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Introduction to SQL Programming Techniques.
Chapter 4B: More Advanced PL/SQL Programming
ISMT221 Information Systems Analysis and Design Prototyping with MS Access Lab 6 Tony Tam.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
IS 4420 Database Fundamentals Chapter 8: Advanced SQL Leon Chen
Data Management Design
Fundamentals, Design, and Implementation, 9/e Chapter 7 Using SQL in Applications.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
The Relational Model Codd (1970): based on set theory Relational model: represents the database as a collection of relations (a table of values --> file)
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Transforming Data Models into Database Designs
Introduction to PL/SQL Chapter 9. Objectives Explain the need for PL/SQL Explain the benefits of PL/SQL Identify the different types of PL/SQL blocks.
Module 9: Managing Schema Objects. Overview Naming guidelines for identifiers in schema object definitions Storage and structure of schema objects Implementing.
The Relational Model These slides are based on the slides of your text book.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
Relational Data Model, R. Ramakrishnan and J. Gehrke with Dr. Eick’s additions 1 The Relational Model Chapter 3.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 8 (Part b): Advanced SQL Modern Database Management 9 th Edition Jeffrey A. Hoffer,
Announcements Read JDBC Project Step 5, due Monday.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
An Investigation of Oracle and SQL Server with respect to Integrity, and SQL Language standards Presented by: Paul Tarwireyi Supervisor: John Ebden Date:
RDB/1 An introduction to RDBMS Objectives –To learn about the history and future direction of the SQL standard –To get an overall appreciation of a modern.
Introduction to SQL Steve Perry
Chapter 7 Advanced SQL Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
I Copyright © 2004, Oracle. All rights reserved. Introduction Copyright © 2004, Oracle. All rights reserved.
SQL Server 7.0 Maintaining Referential Integrity.
11 Copyright س Oracle Corporation, All rights reserved. ® Overview of PL/SQL.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
1 Copyright © 2004, Oracle. All rights reserved. Introduction to PL/SQL.
Relational Databases Database Driven Applications Retrieving Data Changing Data Analysing Data What is a DBMS An application that holds the data manages.
Stored procedures1 Stored procedures and functions Procedures and functions stored in the database.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
Advanced SQL: Cursors & Stored Procedures
1 Copyright © 2004, Oracle. All rights reserved. Introduction to PL/SQL.
8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 8 Advanced SQL.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
1 IT420: Database Management and Organization SQL Views, Triggers and Stored Procedures 17 February 2006 Adina Crăiniceanu
Data Driven Designs 99% of enterprise applications operate on database data or at least interface databases. Most common DBMS are Microsoft SQL Server,
Commercial RDBMSs Access and Oracle. Access DBMS Architchecture  Can be used as a standalone system on a single PC: -JET Engine -Microsoft Data Engine.
The Relational Model Content based on Chapter 3 Database Management Systems, (Third Edition), by Raghu Ramakrishnan and Johannes Gehrke. McGraw Hill, 2003.
Visual Programing SQL Overview Section 1.
Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
CS453: Databases and State in Web Applications (Part 2) Prof. Tom Horton.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Seven: SQL for Database Construction and Application.
Chapter 3: Relational Databases
Chapter 8 Advanced SQL Pearson Education © Chapter 8 - Objectives How to use the SQL programming language How to use SQL cursors How to create stored.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Seven: SQL for Database Construction and Application.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
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.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
Chapter Seven: SQL for Database Construction and Application Processing.
Database Application Development
T-SQL Transact - Structured Query Language (Microsoft)
Database Processing: David M. Kroenke’s Chapter Seven:
Chapter 7 Using SQL in Applications
Chapter 7 Using SQL in Applications
Chapter 8 Advanced SQL.
Chapter 8 Advanced SQL Pearson Education © 2009.
Chapter 11 Managing Databases with SQL Server 2000
© 2014, Mike Murach & Associates, Inc.
Database Application Development
Presentation transcript:

Programming and SQL Edel Sherratt

Motivation 1: Integrity Checking Sometimes primary keys and foreign keys are not enough For example, they do not enforce mandatory participation on the many side of a one-to- many relationship So additional facilities are needed

Integrity Checking (from before) Primary Keys Foreign Keys Referential Integrity Unique/NOT NULL Simple Efficient Preferred (Available in all DBMS) SQL stored modules: Stored Procedures Triggers Functions Whenever necessary and possible Application CodeIf all else fails

Motivation 2: Impedance mismatch Mismatches between application programming language and SQL SQL handles rows of data; a language like C or Java handles only one row at a time SQL is declarative; C is procedural; Java is object oriented and imperative There are usually mismatches between SQL and programming language data types

SQL/PSM (Persistent Stored Modules) Extensions to SQL part of the SQL standard: SQL/PSM (ANSI/ISO/IEC :1999) But not fully implemented Partly because proprietary implementations were developed before the standard

SQL Programming Languages DBMS-specific SQL procedural languages: – Oracle: PL/SQL – Sybase and Microsoft: T-SQL – Informix: SPL – PostgreSQL: PL/pgSQL

Oracle Manual, v10 Using Oracle PL/SQL to improve performance

SQL Programming Language Constructs Functions and procedures IF, WHILE Assignment: both the usual kind and also assignment that results from SQL queries Cursors: allow the rows of a query to be handled one at a time Exception handling Triggers

To find out more The PostgreSQL reference manual: dex.html See section V, Server Programming dex.html Oracle PL/SQL: e/features/plsql/index.html e/features/plsql/index.html Connolly and Begg, Database Systems, fifth ed., Chapter 8: Advanced SQL