Introduction to Databases

Slides:



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

Introduction to SQL 1 Lecture 5. Introduction to SQL 2 Note in different implementations the syntax might slightly differ different features might be.
Basic SQL Introduction Presented by: Madhuri Bhogadi.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A.
6.830/6.814 Lecture 3 Sam Madden Relational Algebra and Normalization Sept 10, 2014.
6.830 / Lecture 2 Data Models Sam Madden “Those who cannot remember the past are doomed to repeat it”
Introduction to Databases CS162 Guest Lecture Sam Madden
COMP 3715 Spring 05. Working with data in a DBMS Any database system must allow user to  Define data Relations Attributes Constraints  Manipulate data.
EECS 339 Lecture 2 Schema Design, Relational Algebra Jennie Duggan January 13, 2014.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A Modified by Donghui Zhang.
Database Management Systems 3ed, Online chapter, R. Ramakrishnan and J. Gehrke1 Query-by-Example (QBE) Online Chapter Example is the school of mankind,
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Query-by-Example (QBE) Chapter 6 Example is the school of mankind, and they will learn at no.
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.
Midterm 1 Concepts Relational Algebra (DB4) SQL Querying and updating (DB5) Constraints and Triggers (DB11) Unified Modeling Language (DB9) Relational.
Subqueries. So far when data has been filtered the filter has been known and simply added to the Where clause but often you don’t know what the filter.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Introduction to Accounting Information Systems
Presentation Handout EDBA – Module 8 Information Technology 21 st December 2014 By K.M.Prashanthan.
Computer Science 101 Database Concepts. Database Collection of related data Models real world “universe” Reflects changes Specific purposes and audience.
PLUG IT IN 3 Fundamentals of Relational Database Operations.
IST 210: ORGANIZATION OF DATA Chapter 1. Getting Started IST210 1.
SQL Structured Query Language Programming Course.
Using Special Operators (LIKE and IN)
What we’ve learnt Doc 5.69 Doc 5.70 Section 1-3. A simple database Related objects Tables hold the data Forms, reports, queries to access the data.
Rebecca McCready Faculty of Medical Sciences Newcastle University Lecture 3 – Queries and Reports.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 3 This material was developed by Oregon Health & Science.
BACS 287 Structured Query Language 1. BACS 287 Visual Basic Table Access Visual Basic provides 2 mechanisms to access data in tables: – Record-at-a-time.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
[ Part III of The XML seminar ] Presenter: Xiaogeng Zhao A Introduction of XQL.
Rebecca McCready Faculty of Medical Sciences Newcastle University Lecture 2 – Relationships and Lookup fields.
CS453: Databases and State in Web Applications (Part 2) Prof. Tom Horton.
Database UpdatestMyn1 Database Updates SQL is a complete data manipulation language that can be used for modifying the data in the database as well as.
CSC 411/511: DBMS Design CSC411_L0_OutlineDr. Nan Wang 1 Course Outline.
Assignment 1 Uploaded to course website Due next Tuesday, Sep 1, at 11:59pm.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 5 SQL.
* Database is a group of related objects * Objects can be Tables, Forms, Queries or Reports * All data reside in Tables * A Row in a Table is a record.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 6 This material was developed by Oregon Health & Science.
WEEK# 12 Haifa Abulaiha November 02,
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 5 SQL.
LINQ to DATABASE-2.  Creating the BooksDataContext  The code combines data from the three tables in the Books database and displays the relationships.
Relational Databases. SQL Sub-queries: queries within queries  So far when data has been filtered the filter has been known and simply added to the Where.
44271: Database Design & Implementation Physical Data Modelling Ian Perry Room: C49 Tel Ext.: 7287
Database Management Systems.  Instructor: Yrd. Doç. Dr. Cengiz Örencik   Course material.
Hoi Le. Why database? Spreadsheet is not good to: Store very large information Efficiently update data Use in multi-user mode Hoi Le2.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
Chapter 1. Getting Started IST 210: Organization of Data IST2101.
IFS180 Intro. to Data Management Chapter 10 - Unions.
1 Database Systems Introduction to Microsoft Access Part 1.
NoSQL Databases NoSQL Concepts Databases Telerik Software Academy
Database Management Systems II
SQL Relational Database Project
Query-by-Example (QBE)
Instructors: Churee Techawut
LINQ to DATABASE-2.
Latihan Create a separate table with the same structure as the Booking table to hold archive records. Using the INSERT statement, copy the records from.
CIS 336 PAPERS Lessons in Excellence-- cis336papers.com.
CIS 336 PAPERS Education for Service-- cis336papers.com.
CIS336 Education for Service-- cis336.com. CIS 336 Final Exam (Feb 2016) For more course tutorials visit CIS 336 Final Exam Question 1.
LINQ to DATABASE-2.
The Relational Model Textbook /7/2018.
Relational Algebra and Normalization 9/13/2017
Data Management Innovations 2017 High level overview of DB
Introduction To Databases GCSE Computer Science
“Those who cannot remember the past are doomed to repeat it”
Introduction To Databases GCSE Computer Science
BUS2206 Access Lab Queries Second Term,
Objective- To graph a relationship in a table.
Introduction to Database Systems CSE 444
Presentation transcript:

Introduction to Databases 6.830 Lecture 1 Sam Madden madden@csail.mit.edu http://db.csail.mit.edu/6.830

Administrivia http://db.csail.mit.edu/6.830 Email: 6.830-staff@mit.edu Ask questions on Piazza! Lecturers: Sam Madden Aaron Elmore TAs: Rebecca Taft Hongyu Yang Office hours: TBD – G9 Lounge

Textbooks Readings in Database Systems Available on Books24x7.com Database Management Systems, 3rd ed. by Ramakrishnan and Gehrke

Zoo Data Model Entity Relationship Diagram 1 Animal contains 1 relationship Cage 1 Age Name Species 1 name age species entity entity Building 1 bldg Time 1 feedTime keeps Keeper 1 Name 1 name entity Animals have names, ages, species Keepers have names Cages have cleaning times, buildings Animals are in 1 cage; cages have multiple animals Keepers keep multiple cages, cages kept by multiple keepers

Our Zoo Sam the Salamander Mike the Giraffe Sally the Student Lanky Slimy

SQL – Structured Query Language SELECT field1, …, fieldM FROM table1, … WHERE condition1, … INSERT INTO table VALUES (field1, …) UPDATE table SET field1 = X, … WHERE condition1,…

Names of Giraffes Imperative Declarative SELECT r.name FROM animals for each row r in animals if r.species = ‘giraffe’ output r.name Declarative SELECT r.name FROM animals WHERE r.species = ‘giraffe’

Cages in Building 32 NESTED LOOPS JOIN Imperative Declarative for each row a in animals for each row c in cages if a.cageno = c.no and c.bldg = 32 output a Declarative SELECT a.name FROM animals AS a, cages AS c WHERE a.cageno = c.no AND c.bldg = 32 JOIN

Average Age of Bears Declarative SELECT AVG(age) FROM animals WHERE species = ‘bear’

Complex Queries Find pairs of animals of the same species and different genders older than 1 year: SELECT a1.name,a2.name FROM animals as a1, animals as a2 WHERE a1.gender = M and a2.gender = F AND a1.species = a2.species AND a1.age > 1 and a2.age > 1 “self join” Find cages with salamanders fed later than the average feedtime of any cage: SELECT cages.cageid FROM cages, animals WHERE animals.species = ’salamander' AND animals.cageid = cages.cageid AND cages.feedtime > (SELECT AVG(feedtime) FROM cages ) “nested queries”

Complex Queries 2 Find keepers who keep both students and salamanders: SELECT keeper.name FROM keeper, cages as c1, cages as c2, keeps as k1, keeps as k2, animals as a1, animals as a2 WHERE c1.cageid = k1.cageid AND keeper.keeperid = k1.keeperid AND c2.cageid = k2.cageid AND keeper.keeperid = k2.keeperid AND a1.species = ’student' AND a2.species = ’salamander' AND c1.cageid = a1.cageid AND c2.cageid = a2.cageid keeper.keeperid = k1.keeperid a1 c1 k1 keeper species = ‘shrew’ a2 c2 k2 keeper.keeperid = k2.keeperid species = ‘student’