CSC443 Database Management Course Introduction Professor Pepper adapted from presentations given by Professor Juliana Freire & Karl Aberer & Yan Chen &

Slides:



Advertisements
Similar presentations
1 Introduction to Database Systems CSE444 Instructor: Scott Vandenberg University of Washington Winter 2000.
Advertisements

Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chapter 1 Instructor: Mirsad Hadzikadic.
Chapter 1 Instructor: Murali Mani Database Management Systems.
1 541: Database Systems S. Muthu Muthukrishnan. 2 Some Data Collections I Have Played With….  Wireless call detail records.  U. S. Patents.  AskJeeves.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Introduction to Database Systems Chapter 1 Instructor: Wang-Chien Lee
Database: A collection of related data [Elmasri]. A database represents some aspect of real world called “miniworld” [Elmasri] or “enterprise” [Ramakrishnan].
Adapted from: ©Silberschatz, Korth and Sudarshan1.1Database System Concepts Chapter 1: Fly-over Introduction Purpose of Database Systems View of Data Data.
©Silberschatz, Korth and Sudarshan1.1Database System Concepts Chapter 1: Introduction Purpose of Database Systems View of Data Data Models Data Definition.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 1: Introduction.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1 Instructor: Deborah Strahman
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 1 Database Systems I Introduction.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1.
On Database Systems.
©Silberschatz, Korth and Sudarshan1.1Database System Concepts Chapter 1: Introduction Purpose of Database Systems View of Data Data Models Data Definition.
1 Introduction to Database Systems Ref. Ramakrishnan & Gehrke Chapter 1.
1 CENG 302 Introduction to Database Management Systems Nihan Kesim Çiçekli URL:
©Silberschatz, Korth and Sudarshan1.1Database System Concepts Chapter 1: Introduction n Why Database Systems? n Data Models n Data Definition Language.
©Silberschatz, Korth and Sudarshan1.1Database System Concepts Chapter 1: Introduction Database Management Systems Purpose of Database Systems View of Data.
Dr. Kalpakis CMSC 461, Database Management Systems Introduction.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1 Instructor: Ethan Jackson
CSCD34 - Data Management Systems,- A. Vaisman1 CSC D34 - Data Management Systems Instructor: Alejandro Vaisman University of Toronto.
CSC343H – Introduction to Databases
CS462: Introduction to Database Systems. ©Silberschatz, Korth and Sudarshan1.2Database System Concepts Course Information Instructor  Kyoung-Don (KD)
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 1: Introduction.
Temple University – CIS Dept. CIS616– Principles of Database Systems V. Megalooikonomou Introduction (based on notes by Silberchatz,Korth, and Sudarshan)
ADVANCED DATABASES WITH ORACLE 11g FOR ADDB7311 LEARNING UNIT 1 of 7.
1 Introduction to databases concepts CCIS – IS department Level 4.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 1: Introduction.
Introduction. 
Database Management Systems 1 Introduction to Database Systems Instructor: Xintao Wu Ramakrishnan & Gehrke.
Chapter 1: Introduction. Unite International College1.2Database Management Systems Chapter 1: Introduction Purpose of Database Systems View of Data Database.
CST203-2 Database Management Systems Lecture 2. One Tier Architecture Eg: In this scenario, a workgroup database is stored in a shared location on a single.
CS6530 Graduate-level Database Systems Prof. Feifei Li.
 DATABASE DATABASE  DATABASE ENVIRONMENT DATABASE ENVIRONMENT  WHY STUDY DATABASE WHY STUDY DATABASE  DBMS & ITS FUNCTIONS DBMS & ITS FUNCTIONS 
1 CS862 - Advanced Database Systems Sang H. Son
Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chpt 1 Instructor: Xintao Wu.
Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chpt 1 Instructor: Weichao Wang.
Database Management Systems
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1 Overview of Database Systems.
INFS614, Dr. Brodsky, GMU1 Database Management Systems INFS 614 Instructor: Professor Alex Brodsky
ICS 321 Fall 2009 Introduction to Database Systems Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa.
Introduction to Database Systems1. 2 Basic Definitions Mini-world Some part of the real world about which data is stored in a database. Data Known facts.
1 What Is a DBMS?  A very large, integrated collection of data.  Models real-world enterprise.  Entities (e.g., students, courses)  Relationships (e.g.,
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 1: Introduction.
Mr.Prasad Sawant, MIT Pune India Introduction to DBMS.
1 CS462- Database Systems Sang H. Son
ASET 1 Amity School of Engineering & Technology B. Tech. (CSE/IT), III Semester Database Management Systems Jitendra Rajpurohit.
Chapter 1: Introduction. 1.2 Database Management System (DBMS) DBMS contains information about a particular enterprise Collection of interrelated data.
Database System Concepts Introduction Purpose of Database Systems View of Data Data Models Data Definition Language Data Manipulation Language Transaction.
Databases Salihu Ibrahim Dasuki (PhD) CSC102 INTRODUCTION TO COMPUTER SCIENCE.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 1.
1 CENG 351 CENG 351 Introduction to Data Management and File Structures Department of Computer Engineering METU.
©Silberschatz, Korth and Sudarshan 1.1 Database System Concepts قواعد البيانات Data Base قواعد البيانات CCS 402 Mr. Nedal hayajneh E- mail
Database Management Systems 1 Ramakrishnan & Gehrke Introduction to Database Systems Chpt 1 Instructor: Xin Zhang.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 1: Introduction.
Introduction to Database Systems Chapter 1
Introduction to Database Systems
Instructor: Elke Rundensteiner
Database Management Systems Chapter 1
Introduction to Database Systems
Overview of Database Systems Chpt 1
Instructor: Murali Mani
Database Management Systems Chapter 1
Chapter 1: Introduction
Database Management Systems
Database Management Systems CSE594
Sang H. Son CS6750: Database Systems The slides for this text are organized into chapters. This lecture covers Chapter 1. Chapter 1: Introduction.
Database Management Systems Chapter 1
Data Independence Applications insulated from how data is structured and stored. Logical data independence: Protection from changes in logical structure.
Is the WWW a DBMS? = Fairly sophisticated search available
Presentation transcript:

CSC443 Database Management Course Introduction Professor Pepper adapted from presentations given by Professor Juliana Freire & Karl Aberer & Yan Chen & Silberschatz, Korth and Sudarshan

Today’s Goals Course Overview  Why study databases?  Why use databases?  Intro to Databases

Major Course Objectives  Design and diagram relational databases  Create Access and Oracle databases  Use SQL commands  Be able to design a good relational database  Know how to get information out of a database to answer any question

Diagramming §Use Case §Class Diagram §Entity Relationship Diagram §Algebraic Relation Model

Tools §Panther l Unix l Oracle §FTP Explorer – register for trial §MS Access

Books §Database System Concepts 5 th Ed l Theory l Cross Reference for fourth ed §Oracle 9i Programming - A Primer l Practical examples §See course syllabus §Available in Library

Learning Resources §Blackboard: my.adelphi.edumy.adelphi.edu §Web site Database System Concepts: l §My office hours: l Tuesday & Thursday 12:15-1:30; Wed :30 l Alumni 114 or Science Lab §My §My phone: §My Web:

Adelphi Account Setup §Panther §Oracle §Blackboard § §Signin Sheet

Projects / Grading §Projects: 40% l Access – 15 l Oracle - 25 §Homework assignments: 20% §Midterm: 20% §Final: 20%.

Assignments §2% dropped for anything 1 day late. §10% dropped for anything 2 weeks late.

Delivering assignments § §ftp §drop box §discussion board §mailbox in math department § me if making a change in delivery place. §forward your from Adelphi

What is a Database Management System? Database Management System = DBMS §A collection of files that store the data §A big program written by someone else that accesses and updates those files for you Relational DBMS = RDBMS §Data files are structured as relations (tables)

Why Study Databases?

What is behind this Web Site? § §Search on a large database §Specify search conditions §Many users §Updates §Access through a web interface Central to Modern Computer Science

Database Systems: Then

Database Systems: Today From Friendster.com on-line tour Field is developing quickly

Other databases you may use Databases are EVERYWHERE

Current Commercial Outlook §A major part of the software industry: l Oracle, IBM, Microsoft, Sybase l also Informix (now IBM), Teradata l smaller players: java-based dbms, devices, OO, … §Well-known benchmarks (esp. TPC) §Lots of related industries l data warehouse, document management, storage, backup, reporting, business intelligence, app integration §Relational products dominant and evolving l adapting for extensibility (user-defined types), adding native XML support. §Open Source coming on strong l MySQL, PostgreSQL, BerkeleyDB

Why Study Databases?? §Need exploded l Corporate: retail swipe/clickstreams, “customer relationship mgmt”, “supply chain mgmt”, “data warehouses”, etc. l Scientific: digital libraries, Human Genome project, NASA Mission to Planet Earth, physical sensors, grid physics network ?

Why study databases?  Data is valuable:  bank account records, tax records, student records…  Protect It! - no matter what Hurricane Flood Human error

Why study databases? Data often structured:  Example: Bank account records all follow the same structure  We can exploit this regular structure To retrieve data in useful ways (that is, we can use a query language) To store data efficiently

Why Study Databases Summary §Central to modern computer science §Databases are everywhere §Commercially successful §Fast moving technology §Plethora of structured data that business and people need

What is a database? §Whiteboard Exercise

Database Definition §Database l – a very large, integrated collection of data. (the stuff) §Models a real-world enterprise l Entities (e.g., teams, games) l Relationships (e.g., The Forty-Niners are playing in The Superbowl) §Database Management System l – software that stores and manages databases (the tools)

Database is better than simple file system because: §Data redundancy, inconsistency and isolation §Difficult to access §Integrity problems §Atomicity of updates (change one file and die before the other completes) §Multiple user issues

So a Database Has: §representing information l data modeling §languages and systems for querying data l complex queries with real semantics* l over massive data sets §concurrency control for data manipulation l controlling concurrent access l ensuring transactional semantics §reliable data storage l maintain data semantics even if you pull the plug * semantics: the meaning or relationship of meanings of a sign or set of signs

Why Use a Database §Why use a database presentationWhy use a database presentation

What is in a database?

Describing Data: Data Models §A data model is a collection of concepts for describing data. §A schema is a description of a particular collection of data, using a given data model. §A relation is the data stored in a certain schema §The relational model of data is the most widely used model today. l Entities and relations among them l Integrity constraints and business rules l Perspective dependent (warehouse & sales view item differently)

Database Design The process of designing the general structure of the database: §Logical Design – Deciding on the database schema. l Business decision – What attributes l Computer Science decision – What relation schemas §Physical Design – Deciding on the physical layout of the database

Data Models §A collection of tools for describing l Data l Data relationships l Data semantics l Data constraints §Relational model §Entity-Relationship data model (mainly for database design) §Object-based data models (Object-oriented and Object-relational) §Semistructured data model (XML) §Other older models: l Network model l Hierarchical model

The Entity-Relationship Model §Models an enterprise as a collection of entities and relationships l Entity: a “thing” or “object” in the enterprise that is distinguishable from other objects Described by a set of attributes l Relationship: an association among several entities §Represented diagrammatically by an entity-relationship diagram:

Relational Model §ER for concept  map to Algebraic Relational Model §Relations (tables of possible data) §Instance (actual data at a given time) §Schema (description of those tables, their relations)

Relational Model Terminology

Relational Model Look §Notation:  p (r) §p is called the selection predicate §Defined as:  p (r) = {t | t  r and p(t)} Where p is a formula in propositional calculus consisting of terms connected by :  (and),  (or),  (not) Each term is one of: op or where op is one of: =, , >, . <.  §Example of selection:  branch_name=“Perryridge” (account)

Object-Relational Data Models §Extend the relational data model by including object orientation and constructs to deal with added data types. §Allow attributes of tuples to have complex types, including non-atomic values such as nested relations. §Preserve relational foundations, in particular the declarative access to data, while extending modeling power. §Provide upward compatibility with existing relational languages.

Design Goals  Design Goals:  Avoid redundant data  Ensure that relationships among attributes represented  Ensure constraints are properly modeled: updates  check for violation of database integrity constraints.

Bad Design

Queries §What the programmer sees

Some Basic SQL Commands §Select – Get rows of data §* - everything §From – the name of the table (relation) will follow §Where – Only get the stuff that matches §Example: Select * from movies where theater = Loews §Exercise – l Write down the query to select all of your friends that live in NY State

Example: University Database §Conceptual schema: l Students(sid: string, name: string, login: string, age: integer, gpa:real) l Courses(cid: string, cname:string, credits:integer) l Enrolled(sid:string, cid:string, grade:string) §External Schema (View): l Course_info(cid:string,enrollment:cid:string,enrollment integer) §Physical schema: l Relations stored as unordered files. l Index on first column of Students. l Key to good performance Physical Schema Conceptual Schema View 1View 2View 3 DB

Data Independence (levels of abstraction) §Applications insulated from how data is structured and stored. §Logical data independence: Protection from changes in logical structure of data – stablize views. §Physical data independence: Protection from changes in physical structure of data. §Q: Why are these particularly important for DBMS? Physical Schema Conceptual Schema View 1View 2View 3 DB

Queries §Change and get data from a database §Run over data model §Easy & efficient §Not good for complex calculations §DML and DDL

Data Manipulation Language (DML) §Language for accessing and manipulating the data organized by the appropriate data model l DML also known as query language §Two classes of languages l Procedural – user specifies what data is required and how to get those data l Declarative (nonprocedural) – user specifies what data is required without specifying how to get those data §SQL is the most widely used query language

Data Definition Language (DDL) §Specification notation for defining the database schema Example:create table account ( account-number char(10), balance integer) §DDL compiler generates a set of tables stored in a data dictionary §Data dictionary contains metadata (i.e., data about data) l Database schema l Data storage and definition language Specifies the storage structure and access methods used l Integrity constraints Domain constraints Referential integrity (references constraint in SQL) Assertions l Authorization

Queries - What does it look like? §System handles query plan generation & optimization; ensures correct execution. SELECT eid, ename, title FROM Emp E WHERE E.sal > $50K SELECT E.loc, AVG(E.sal) FROM Emp E GROUP BY E.loc HAVING Count(*) > 5 SELECT COUNT DISTINCT (E.eid) FROM Emp E, Proj P, Asgn A WHERE E.eid = A.eid AND P.pid = A.pid AND E.loc <> P.loc §Issues: view reconciliation, operator ordering, physical operator choice, memory management, access path (index) use, … EmployeesProjectsAssignments Emp Select  Emp Group(agg) HavingEmp Count distinct  Asgn Join Join Proj

SQL §SQL: widely used non-procedural language l Example: Find the name of the customer with customer-id selectcustomer.customer_name fromcustomer wherecustomer.customer_id = ‘ ’ l Example: Find the balances of all accounts held by the customer with customer-id selectaccount.balance from depositor, account where depositor.customer_id = ‘ ’ and depositor.account_number = account.account_number §Application programs generally access databases through one of l Language extensions to allow embedded SQL l Application program interface (e.g., ODBC/JDBC) which allow SQL queries to be sent to a database §For us: Oracle and Access SQL languages

A Look underneath

Concurrency Control §Concurrent execution of user programs: key to good DBMS performance. l Disk accesses frequent, pretty slow l Keep the CPU working on several programs concurrently. §Interleaving actions of different programs: trouble! l e.g., account-transfer & print statement at same time §DBMS ensures such problems don’t arise. l Users/programmers can pretend they are using a single- user system. (called “Isolation”) l Thank goodness! Don’t have to program “very, very carefully”.

Transactions: ACID Properties §Key concept is a transaction: a sequence of database actions (reads/writes). §DBMS ensures atomicity (all-or-nothing property) even if system crashes in the middle. §Each transaction, executed completely, must take the DB between consistent states or must not run at all. §DBMS ensures that concurrent transactions appear to run in isolation. §DBMS ensures durability of committed Xacts even if system crashes. §DBMS can enforce simple integrity constraints on the data.

Ensuring Transaction Properites §DBMS ensures atomicity (all-or-nothing property) even if system crashes in the middle of a Xact. §DBMS ensures durability of committed Xacts even if system crashes. §Idea: Keep a log (history) of all actions carried out by the DBMS while executing a set of Xacts: l Before a change is made to the database, the corresponding log entry is forced to a safe location. l After a crash, the effects of partially executed transactions are undone using the log. Effects of committed transactions are redone using the log. l trickier than it sounds!

The Log §The following actions are recorded in the log: l Ti writes an object: the old value and the new value. Log record must go to disk before the changed page! l Ti commits/aborts: a log record indicating this action. §Log is often duplexed and archived on “stable” storage. §All log related activities (and in fact, all concurrency control related activities such as lock/unlock, dealing with deadlocks etc.) are handled transparently by the DBMS.

Structure of a DBMS §A typical DBMS has a layered architecture. §The figure does not show the concurrency control and recovery components. §Each database system has its own variations. Query Optimization and Execution Relational Operators Files and Access Methods Buffer Management Disk Space Management DB These layers must consider concurrency control and recovery

Overall System Structure

…must understand how a DBMS works Databases make these folks happy... §DBMS vendors, programmers $20 million industry l Oracle, IBM, MS, Sybase, … §End users §Business, education, science, … §DB application programmers l Eg smart webmasters l Build web services that run off DBMSs §Database administrators (DBAs) l Design logical/physical schemas l Handle security and authorization l Data availability, crash recovery l Database tuning as needs evolve

Summary  What is a database – lots of data organized into entities and schemes with a manager  Why study databases? – common use, needed for programming apps  Why use databases? – all the advantages over flat file systems  Intro to Databases  Logical layer:  Query language, data models, transactions  Physical layer  Actual files with indexes, query processing, concurrency, recovery & logs