LBSC 690 Session #7 Structured Information: Databases Jimmy Lin The iSchool University of Maryland Wednesday, October 15, 2008 This work is licensed under.

Slides:



Advertisements
Similar presentations
Relational Databases Week 9 INFM 603.
Advertisements

Chapter 4 Database Processing. Agenda Purpose of Database Terminology Components of Database System Multi-user Processing Database Design Entity-relationship.
Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
Database Concepts Lec. 5. What Is a Database? Data are unprocessed raw facts that include text, number, images, audio, and video. Information is processed.
©Silberschatz, Korth and Sudarshan1.1Database System Concepts Chapter 1: Introduction Purpose of Database Systems View of Data Data Models Data Definition.
Chapter Information Systems Database Management.
From Class Diagrams to Databases. So far we have considered “objects” Objects have attributes Objects have operations Attributes are the things you record.
Introduction to Databases CIS 5.2. Where would you find info about yourself stored in a computer? College Physician’s office Library Grocery Store Dentist’s.
LBSC 690 Session #8 SQL and Web Applications Jimmy Lin The iSchool University of Maryland Wednesday, October 22, 2008 This work is licensed under a Creative.
1 A Closer Look Chapter 2. 2 Underlying Concepts of Databases and Transaction Processing.
Databases Week 7 LBSC 690 Information Technology.
Week 6 LBSC 690 Information Technology
Databases Week 6 LBSC 690 Information Technology.
LBSC 690: Session 7 Relational Databases
1 The Big Picture of Databases We are particularly interested in relational databases Data is stored in tables.
Getting Started Chapter One DATABASE CONCEPTS, 7th Edition
Relational Databases Week 7 LBSC 690 Information Technology.
Compe 301 ER - Model. Today DBMS Overview Data Modeling Going from conceptual requirements of a application to a concrete data model E/R Model.
Distributed Databases
IST Databases and DBMSs Todd S. Bacastow January 2005.
1 Relational Databases. 2 Find Databases here… 3 And here…
Relational Databases Week 13 LBSC 671 Creating Information Infrastructures.
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
Relational Databases Week 9 INFM 603. Agenda Relational database design Microsoft Access MySQL Main Class Project Proposal Presentation.
1 DATABASE TECHNOLOGIES BUS Abdou Illia, Fall 2007 (Week 3, Tuesday 9/4/2007)
Databases From A to Boyce Codd. What is a database? It depends on your point of view. For Manovich, a database is a means of structuring information in.
Introduction to Databases
Introduction. 
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
1 CSE 480: Database Systems Lecture 23: Transaction Processing and Database Recovery.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
1 INTRODUCTION TO DATABASE MANAGEMENT SYSTEM L E C T U R E
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Wednesday, March 5, 2014 Session 6: Relational.
Databases Session 5 LIS 7008 Information Technologies LSU/SLIS.
Relational Database Management Systems. A set of programs to manage one or more databases Provides means for: Accessing the data Inserting, updating and.
Databases From A to Boyce Codd. What is a database? It depends on your point of view. For Manovich, a database is a means of structuring information in.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
GUS: 0262 Fundamentals of GIS Lecture Presentation 3: Relational Data Model Jeremy Mennis Department of Geography and Urban Studies Temple University.
Databases Week 5 LBSC 690 Information Technology.
DAY 12: DATABASE CONCEPT Tazin Afrin September 26,
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
Introduction to Databases Trisha Cummings. What is a database? A database is a tool for collecting and organizing information. Databases can store information.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
1 IRU Concurrency, Reliability and Integrity issues Geoff Leese October 2007 updated August 2008, October 2009.
Instructor: Dema Alorini Database Fundamentals IS 422 Section: 7|1.
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
Relational Databases Week 11 LBSC 671 Creating Information Infrastructures.
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.
Chapter 9 Database Systems © 2007 Pearson Addison-Wesley. All rights reserved.
U:/msu/course/cse/103 Day 18, Slide 1 CSE 103 Day 18 If you are not enrolled in CSE 103, please save and log out by 10:10.
Relational Databases Week 7 INFM 603.
1 CS462- Database Systems Sang H. Son
Data The fact and figures that can be recorded in system and that have some special meaning assigned to it. Eg- Data of a customer like name, telephone.
ASET 1 Amity School of Engineering & Technology B. Tech. (CSE/IT), III Semester Database Management Systems Jitendra Rajpurohit.
CS3431: C-Term CS3431 – Database Systems I Introduction Instructor: Mohamed Eltabakh
Data Modeling Session 12 INST 301 Introduction to Information Science.
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
Relational Databases (Part 2) Session 14 INST 301 Introduction to Information Science.
CSCI-235 Micro-Computers in Science Databases. Database Concepts Data is any unorganized text, graphics, sounds, or videos A database is a collection.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
Rationale Databases are an integral part of an organization. Aspiring Database Developers should be able to efficiently design and implement databases.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Databases and DBMSs Todd S. Bacastow January
Databases We are particularly interested in relational databases
Chapter 1: Introduction
Information Systems Database Management
Microsoft Access and SQL
Week 6 LBSC 690 Information Technology
Presentation transcript:

LBSC 690 Session #7 Structured Information: Databases Jimmy Lin The iSchool University of Maryland Wednesday, October 15, 2008 This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States See for details

The iSchool University of Maryland Take-Away Messages Databases are suitable for storing structured information Databases are important tools to organize, manipulate, and access structured information Databases are integral components of modern Web applications

Databases Yesterday… Database today?

What’s structured information? It’s what you put in a database What’s a database? It’s what you store structured information in

So what’s a database? An integrated collection of data organized according to some model…

So what’s a relational database? An integrated collection of data organized according to a relational model

Database Management System (DBMS) Software system designed to store, manage, and facilitate access to databases

The iSchool University of Maryland Databases (try to) model reality… Entities: things in the world Example: airlines, tickets, passengers Relationships: how different things are related Example: the tickets each passenger bought “Business Logic”: rules about the world Example: fare rules

So what’s the Web?

Source: Microsoft Office Clip Art Relational Databases

The iSchool University of Maryland Components of a Relational Database Field: an “atomic” unit of data Record: a collection of related fields Table: a collection of related records Each record is a row in the table Each field is a column in the table Database: a collection of tables

The iSchool University of Maryland A Simple Example NameDOBSSN John Doe04/15/ Jane Smith08/31/ Mary Adams11/05/ Field Field Name Record Primary Key Table

The iSchool University of Maryland Why “Relational”? View of the world in terms of entities and relations between them: Tables represent “relations” Each row in the table is sometimes called a “tuple” Each tuple is “about” an entity Fields can be interpreted as “attributes” or “properties” of the entity Data is manipulated by “relational algebra”: Defines things you can do with tuples Expressed in SQL

The iSchool University of Maryland The Registrar Example What do we need to know? Something about the students (e.g., first name, last name, , department) Something about the courses (e.g., course ID, description, enrolled students, grades) Which students are in which courses How do we capture these things?

The iSchool University of Maryland A First Try Put everything in a big table… Why is this a bad idea?

The iSchool University of Maryland Goals of “Normalization” Save space Save each fact only once More rapid updates Every fact only needs to be updated once More rapid search Finding something once is good enough Avoid inconsistency Changing data once changes it everywhere

The iSchool University of Maryland Another Try... Student Table Department TableCourse Table Enrollment Table

The iSchool University of Maryland Keys “Primary Key” uniquely identifies a record e.g., student ID in the student table “Foreign Key” is primary key in the other table It need not be unique in this table

The iSchool University of Maryland Approaches to Normalization For simple problems (like the homework): Start with the entities you’re trying to model Group together fields that “belong together” Add keys where necessary to connect entities in different tables For more complicated problems: Entity-relationship modeling (LBSC 670)

The iSchool University of Maryland The Data Model Student Table Department TableCourse Table Enrollment Table

The iSchool University of Maryland Registrar ER Diagram Enrollment Student Course Grade … Student Student ID First name Last name Department … Course Course ID Course Name … Department Department ID Department Name … has associated with

The iSchool University of Maryland Types of Relationships One-to-OneOne-to-Many Many-to-Many

The iSchool University of Maryland Database Integrity Registrar database must be internally consistent All enrolled students must have an entry in the student table All courses must have a name … What happens: When a student withdraws from the university? When a course is taken off the books?

The iSchool University of Maryland Integrity Constraints Conditions that must be true of the database at any time Specified when the database is designed Checked when the database is modified RDBMS ensures that integrity constraints are always kept So that database contents remain faithful to the real world Helps avoid data entry errors Where do integrity constraints come from?

Relational Algebra (Don’t Panic!)

The iSchool University of Maryland Join “Joined” Table Student Table Department Table

The iSchool University of Maryland Project SELECT Student ID, Department

The iSchool University of Maryland Restrict WHERE Department ID = “HIST”

The iSchool University of Maryland Relational Operations Joining tables: JOIN Choosing columns: SELECT Based on their labels (field names) Choosing rows: WHERE Based on their contents These can be specified together department ID = “HIST” SELECT Student ID, Dept WHERE Dept = “History”

So how’s a database more than a spreadsheet?

The iSchool University of Maryland Databases in Web Applications Browser Database Browser Client Server network Web Server “Middleware” Web Server Database

The iSchool University of Maryland Database in the “Real World” Typical database applications: Banking (e.g., saving/checking accounts) Trading (e.g., stocks) Traveling (e.g., airline reservations) Networking (e.g., Facebook) … Characteristics: Lots of data Lots of concurrent operations Must be fast “Mission critical” (well… sometimes)

The iSchool University of Maryland Operational Requirements Must hold a lot of data Must be reliable Must be fast Must support concurrent operations

Must hold a lot of data Solution: Use lots of machines (Each machine holds a small slice) So which machine has your copy?

Must be reliable Solution: Use lots of machines (Store multiple copies) How do you keep the copies in sync? But which copy is the right one?

Must be fast Solution: Use lots of machines (Share the load) How do you spread the load?

Must support concurrent operations Solution: this is hard! (But fortunately doesn’t matter for many applications)

The iSchool University of Maryland Database Transactions Transaction = sequence of database actions grouped together e.g., transfer $500 from checking to savings ACID properties: Atomicity: all-or-nothing Consistency: each transaction must take the DB between consistent states Isolation: concurrent transactions must appear to run in isolation Durability: results of transactions must survive even if systems crash

The iSchool University of Maryland Making Transactions Idea: keep a log (history) of all actions carried out while executing transactions Before a change is made to the database, the corresponding log entry is forced to a safe location Recovering from a crash: Effects of partially executed transactions are undone Effects of committed transactions are redone Trickier than it sounds! the log

Source: Technology Review (July/August, 2008) Database layer: 800 eight-core Linux servers running MySQL (40 TB user data) Caching servers: 15 million requests per second, 95% handled by memcache (15 TB of RAM)

The iSchool University of Maryland RideFinder Exercise Design a database to match drivers with passengers (e.g., for road trips): Drivers post available seats; they want to know about interested passengers Passengers call up looking for rides: they want to know about available rides (they don’t get to post “rides wanted” ads) These things happen in no particular order

The iSchool University of Maryland Exercise Goals Design the tables you will need First decide what information you need to keep track of Then design tables to capture this information Design queries (using join, project, and restrict) What happens when a passenger comes looking for a ride? What happens when a driver comes to find out who his passengers are? Role play!