Introduction to Data Management CSE 344. Lecture 2: Data Models

Similar documents
Announcements. Using Electronics in Class. Review. Staff Instructor: Alvin Cheung Office hour on Wednesdays, 1-2pm. Class Overview

Introduction to Databases CSE 414. Lecture 2: Data Models

CSE 344 JANUARY 5 TH INTRO TO THE RELATIONAL DATABASE

Introduction to Database Systems CSE 414. Lecture 3: SQL Basics

CSE 344 JANUARY 8 TH SQLITE AND JOINS

Introduction to Database Systems CSE 414. Lecture 3: SQL Basics

Lecture 2: Introduction to SQL

Introduction to SQL Part 1 By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford)

Big Data Processing Technologies. Chentao Wu Associate Professor Dept. of Computer Science and Engineering

Lecture 3: SQL Part II

DS Introduction to SQL Part 1 Single-Table Queries. By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford)

MTAT Introduction to Databases

Introduction to Database Systems CSE 444

CMPT 354: Database System I. Lecture 2. Relational Model

Introduction to Data Management CSE 414

DS Introduction to SQL Part 2 Multi-table Queries. By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford)

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344

Principles of Database Systems CSE 544. Lecture #1 Introduction and SQL

Agenda. Discussion. Database/Relation/Tuple. Schema. Instance. CSE 444: Database Internals. Review Relational Model

Announcements. Agenda. Database/Relation/Tuple. Discussion. Schema. CSE 444: Database Internals. Room change: Lab 1 part 1 is due on Monday

Announcements. Multi-column Keys. Multi-column Keys. Multi-column Keys (3) Multi-column Keys (2) Introduction to Data Management CSE 414

Principles of Database Systems CSE 544. Lecture #1 Introduction and SQL

Database Systems CSE 414

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams

Announcements. Agenda. Database/Relation/Tuple. Schema. Discussion. CSE 444: Database Internals

Principles of Database Systems CSE 544. Lecture #2 SQL The Complete Story

5/17/17. Announcements. Review: Transactions. Outline. Review: TXNs in SQL. Review: ACID. Database Systems CSE 414.

Lecture 3 Additional Slides. CSE 344, Winter 2014 Sudeepa Roy

Database Systems CSE 414

Announcements. Multi-column Keys. Multi-column Keys (3) Multi-column Keys. Multi-column Keys (2) Introduction to Data Management CSE 414

Database Systems CSE 303. Lecture 02

Database Systems CSE 303. Lecture 02

Introduction to Data Management CSE 344. Lectures 8: Relational Algebra

SQL. Assit.Prof Dr. Anantakul Intarapadung

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344. Lectures 8: Relational Algebra

Introduction to Data Management CSE 344

Before we talk about Big Data. Lets talk about not-so-big data

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2006 Lecture 3 - Relational Model

DATABASE MANAGEMENT SYSTEMS. UNIT I Introduction to Database Systems

Informatics 1: Data & Analysis

Database Systems CSE 414

CS143: Relational Model

CSE 544 Principles of Database Management Systems

Part I: Structured Data

Introduction to Data Management CSE 344

JSON - Overview JSon Terminology

Announcements. JSon Data Structures. JSon Syntax. JSon Semantics: a Tree! JSon Primitive Datatypes. Introduction to Database Systems CSE 414

Introduction to Data Management CSE 344

Polls on Piazza. Open for 2 days Outline today: Next time: "witnesses" (traditionally students find this topic the most difficult)

CSE 544 Principles of Database Management Systems

Announcements. Two Classes of Database Applications. Class Overview. NoSQL Motivation. RDBMS Review: Serverless

CS 245: Principles of Data-Intensive Systems. Instructor: Matei Zaharia cs245.stanford.edu

Ø Last Thursday: String manipulation & Regular Expressions Ø guest lecture from the amazing Sam Lau Ø reviewed in section and in future labs & HWs

CSE 544 Principles of Database Management Systems. Fall 2016 Lecture 4 Data models A Never-Ending Story

Announcements. Transaction. Motivating Example. Motivating Example. Transactions. CSE 444: Database Internals

CSE 544 Principles of Database Management Systems. Lecture 4: Data Models a Never-Ending Story

Chapter 1: Introduction

CSE 344 APRIL 16 TH SEMI-STRUCTURED DATA

CSE 544 Data Models. Lecture #3. CSE544 - Spring,

Class Overview. Two Classes of Database Applications. NoSQL Motivation. RDBMS Review: Client-Server. RDBMS Review: Serverless

INF 212 ANALYSIS OF PROG. LANGS SQL AND SPREADSHEETS. Instructors: Crista Lopes Copyright Instructors.

Introduction to Data Management CSE 344

CSE 544 Principles of Database Management Systems

Database Systems CSE 414

Database Management Systems CSEP 544. Lecture 9: Transactions and Recovery

The Relational Data Model

SQL DDL. Intro SQL CREATE TABLE ALTER TABLE Data types Service-based database in Visual Studio Database in PHPMyAdmin

Niklas Fors The Relational Data Model 1 / 17

Announcements. Asterix Data Model (ADM) Datatypes. Closed Types. Open Types. Introduction to Database Systems CSE 414

Outline. Database Management Systems (DBMS) Database Management and Organization. IT420: Database Management and Organization

Database Technology Introduction. Heiko Paulheim

Outline. Quick Introduction to Database Systems. Data Manipulation Tasks. What do they all have in common? CSE142 Wi03 G-1

ACS-3902 Fall Ron McFadyen 3D21 Slides are based on chapter 5 (7 th edition) (chapter 3 in 6 th edition)

Information Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language

SQL: Data Definition Language

What we already know. Late Days. CSE 444: Database Internals. Lecture 3 DBMS Architecture

Database Systems CSE 414

5/2/16. Announcements. NoSQL Motivation. The New Hipster: NoSQL. Serverless. What is the Problem? Database Systems CSE 414

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas

Lectures 2&3: Introduction to SQL

Announcements. Outline UNIQUE. (Inner) joins. (Inner) Joins. Database Systems CSE 414. WQ1 is posted to gradebook double check scores

Your New App. Motivation. Data Management is Universal. Staff. Introduction to Data Management (Database Systems) CSE 414. Lecture 1: Introduction

Relational Model and Algebra. Introduction to Databases CompSci 316 Fall 2018

Introduction to Relational Database Management Systems

Introduction to Data Management CSE 344

Lecture 1: Relational Databases

CSE 414 Midterm. April 28, Name: Question Points Score Total 101. Do not open the test until instructed to do so.

COMP 430 Intro. to Database Systems

Introduction to Data Management CSE 344

Introduction to Database Systems CSE 414

Course Introduction & History of Database Systems

CSE 444: Database Internals. Lecture 3 DBMS Architecture

Introduction. Example Databases

Lecture 16. The Relational Model

Operating systems fundamentals - B07

SQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

SQL Introduction. CS 377: Database Systems

Transcription:

Introduction to Data Management CSE 344 Lecture 2: Data Models CSE 344 - Winter 2017 1

Announcements WQ1 and HW1 are out Use your CSE ids to access the HW docs Use Piazza to post questions OHs are up on website CSE 344 - Winter 2017 2

This is a huge room Please sit in the front I promise I don t bite! Ground Rules Let us know if you have suggestions for the class Don t wait till course evals! Slides will be available before lecture We can bring hardcopies if needed Some slides have details missing Please pay attention in class and take notes! CSE 344 - Winter 2017 3

Using Electronics in Class Opened laptops create disturbances to your neighbors Please sit in the back if you use your laptop to take notes OK if you use surfaces And please don t check your email / sms / youtube / fb / etc during class If people are doing this we will have to ban all laptops L CSE 344 - Winter 2017 4

Class Overview Relational Data Model SQL, Relational Algebra, Relational Calculus, datalog Query processing and optimization Semistructured Data Model JSon (NoSQL) Conceptual design E/R diagrams, Views, and Database normalization Transactions and their implementations Parallel databases MapReduce, and Spark CSE 344 - Winter 2017 5

Today Data models Relational data model SQL CSE 344 - Winter 2017 6

Review What is a database? A collection of files storing related data What is a DBMS? An application program that allows us to manage efficiently the collection of data files CSE 344 - Winter 2017 7

Data Models Suppose we have book data: author, title, publisher, pub date, price, etc How should we organize such data in files? Data model: a general, conceptual way of structuring data CSE 344 - Winter 2017 8

Relational Data Models Data represented as relations Semi-structured (JSon) Data represented as trees Key-value pairs Used by NoSQL systems Graph Object-oriented We will study the first three in 344 CSE 344 - Winter 2017 9

3 Elements of Data Models Instance The actual data Schema Describe what data is being stored Query language How data can be retrieved and manipulated CSE 344 - Winter 2017 10

Turing Awards in Data Management Charles Bachman, 1973 IDS and CODASYL Ted Codd, 1981 Relational model Jim Gray, 1998 Transaction processing Michael Stonebraker, 2014 INGRES and Postgres CSE 344 - Winter 2017 11

The Relational Data Model Instance Organized as table or relation Consists of column aka attribute aka field row aka tuple aka record Schema table name aka relation name column name aka attribute name Each attribute has a type aka domain aka data type CSE 344 - Winter 2017 12

The Relational Data Model degree or arity of a relation Number of attributes Example types: Strings: CHAR(20), VARCHAR(50), TEXT Numbers: INT, SMALLINT, FLOAT MONEY, DATETIME, Usually vendor specific Statically and strictly enforced CSE 344 - Winter 2017 13

Keys An attribute that uniquely identifies a record Example? A key can consist of multiple attributes What does that mean? CSE 344 - Winter 2017 14

Keys A relation can have many keys But only one of them can be chosen to be the primary key Foreign key: An attribute(s) that is a key for other relations CSE 344 - Winter 2017 15

Relation Model: Example Instance cname country no_employees for_profit Canon Japan 50000 Y Hitachi Japan 30000 Y Schema Company(cname, country, no_employees, for_profit) Company(cname: varchar(30), country: char(20), no_employees: int, for_profit: char(1)) CSE 344 - Winter 2017 16

Relational Model: Example Company(cname, country, no_employees, for_profit) Country(name, population) cname country no_employees for_profit Canon Japan 50000 Y Hitachi Japan 30000 Y name USA Japan population 320M 127M CSE 344 - Winter 2017 17

Aside: Semi-Structured Model: Example Company(cname, country, no_employees, for_profit) Country(name, population) CSE 344 - Winter 2017 18

SQL Query Language Structured Query Language Developed by IBM in the 70s Most widely used language to query relational data We will see other languages for the relational model later on Relational algebra, relational calculus, etc. CSE 344 - Winter 2017 19

Our First DBMS SQL Lite Will switch to SQL Server later in the quarter CSE 344 - Winter 2017 20

Demo CSE 344 - Winter 2017 21

Discussion Tables are NOT ordered they are sets or multisets (bags) Tables are FLAT No nested attributes Tables DO NOT prescribe how they are implemented / stored on disk This is called physical data independence CSE 344 - Winter 2017 22

Table Implementation How would you implement this? cname country no_employees for_profit Canon Japan 50000 Y Hitachi Japan 30000 Y What happens when you alter a table? Physical data independence The logical definition of the data remains unchanged, even when we make changes to the actual implementation CSE 344 - Winter 2017 23

Adding Attributes cname country no_employees for_profit Canon Japan 50000 Y Hitachi Japan 30000 Y Let s add a list of product that each company produces How? Recall that tables are flat! CSE 344 - Winter 2017 24

Adding Attributes cname country no_employees for_profit Canon Japan 50000 Y Hitachi Japan 30000 Y Product(pname, price, category, manufacturer) pname price category manufacturer SingleTouch 149.99 photography Canon AC 300 Appliance Hitachi CSE 344 - Winter 2017 25

Demo CSE 344 - Winter 2017 26