INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Wednesday, March 5, 2014 Session 6: Relational.

Slides:



Advertisements
Similar presentations
Relational Databases Week 9 INFM 603.
Advertisements

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.
Chapter Information Systems Database Management.
LBSC 690 Session #7 Structured Information: Databases Jimmy Lin The iSchool University of Maryland Wednesday, October 15, 2008 This work is licensed under.
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.
1 Introduction to Web Application Introduction to Data Base.
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 DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 5 th Edition.
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.
Transactions and Recovery
Chapter 4 Relational Databases and Enterprise Systems
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.
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)
Introduction. 
1 CSE 480: Database Systems Lecture 23: Transaction Processing and Database Recovery.
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
Introduction to SQL Steve Perry
1 INTRODUCTION TO DATABASE MANAGEMENT SYSTEM L E C T U R E
Concepts and Terminology Introduction to Database.
Databases Session 5 LIS 7008 Information Technologies LSU/SLIS.
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
Relational Database Management Systems. A set of programs to manage one or more databases Provides means for: Accessing the data Inserting, updating and.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
1 What is database 2? What is normalization? What is SQL? What is transaction?
Introduction to Databases Trisha Cummings. What is a database? A database is a tool for collecting and organizing information. Databases can store information.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
1 CS 430 Database Theory Winter 2005 Lecture 16: Inside a DBMS.
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.
Dimu' Rumpak © 2009 by Prentice Hall 1 Getting Started Didimus Rumpak, M.Si. Database Concepts Chapter 1 1.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 7 Introduction to Structured.
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.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
The Relational Model1 Transaction Processing Units of Work.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Computer Science and Engineering Computer System Security CSE 5339/7339 Session 21 November 2, 2004.
Introduction.  Administration  Simple DBMS  CMPT 454 Topics John Edgar2.
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.
10 1 Chapter 10 - A Transaction Management Database Systems: Design, Implementation, and Management, Rob and Coronel.
Data Modeling Session 12 INST 301 Introduction to Information Science.
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.
Chapter 2 The Big Picture. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 2-2 Databases We are particularly interested in relational databases.
Databases and DBMSs Todd S. Bacastow January
Logical Database Design and the Rational Model
Databases We are particularly interested in relational databases
 2012 Pearson Education, Inc. All rights reserved.
Information Systems Database Management
Database Fundamentals
Lesson Objectives Aims You should know about: 1.3.2: (a) indexing (d) SQL – Interpret and Modify (e) Referential integrity (f) Transaction processing,
Week 6 LBSC 690 Information Technology
Presentation transcript:

INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Wednesday, March 5, 2014 Session 6: Relational Databases

Databases Yesterday…

Databases 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

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

Source: Microsoft Office Clip Art Relational Databases

Components of a Relational Database Field: an “atomic” unit of data Record: a collection of related fields Sometimes called a “tuple” 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

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

Why “Relational”? View of the world in terms of entities and relations: Tables represent “relations” Each row (record, 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 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?

A First Try Put everything in a big table… Why is this a bad idea?

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

Another Try... Student Table Department TableCourse Table Enrollment Table

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

Approaches to Normalization For simple problems: 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

The Data Model Student Table Department TableCourse Table Enrollment Table

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

A Real Example

Types of Relationships One-to-OneOne-to-Many Many-to-Many

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?

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?

SQL (Don’t Panic!)

Select select Student ID, Department

Where where Department ID = “HIST”

Simple SQL Statements Choosing columns: SELECT Based on their labels (field names) * is a shorthand for saying “all fields” Choosing rows: WHERE Based on their contents These can be specified together department ID = “HIST”

Simple SQL Template select [columns in the table] from [table name] where [selection criteria]

SQL Tips and Tricks Referring to fields (in SELECT statements) Use TableName.FieldName Can drop TableName if FieldName is unambiguous Selection criteria Use = instead of == Note, different dialects of SQL!

Join “Joined” Table Student Table Department Table

SQL Template for Joins select [columns in the table] from [table name] join [another tablename] on [join criterion] … where [selection criteria] Join criterion: usually, based on primary/foreign key relationships e.g., Table1.PrimaryKey = Table2.ForeignKey

Aggregations SQL aggregation functions Examples: count, min, max, sum, avg Use in select statements Tip: when trying to write SQL query with aggregation, do it first without Group by [field] Often used in conjunction with aggregation Conceptually, breaks table apart based on the [field] select count(*)… select min(price)… select sum(length)…

How do you want your results served? Order by [field name] Does exactly what you think it does! Either “asc” or “desc” Limit n Returns only n records Useful to retrieving the top n or bottom n

So how’s a database more than a spreadsheet?

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

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)

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 yield a consistent state Isolation: concurrent transactions must appear to run in isolation Durability: results of transactions must survive even if systems crash

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)

Now you know… Wait, but these are websites?