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

Similar documents
Introduction to Databases CSE 414. Lecture 2: Data Models

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

CSE 344 JANUARY 5 TH INTRO TO THE RELATIONAL DATABASE

CSE 344 JANUARY 8 TH SQLITE AND JOINS

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

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

Lecture 2: Introduction to SQL

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

Database Systems CSE 414

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

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

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

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

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

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

JSON - Overview JSon Terminology

Introduction to Data Management CSE 344

Lecture 3: SQL Part II

DATABASE MANAGEMENT SYSTEMS. UNIT I Introduction to Database Systems

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

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

Database Systems CSE 414

Introduction to Data Management CSE 414

CS143: Relational Model

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

Data! CS 133: Databases. Goals for Today. So, what is a database? What is a database anyway? From the textbook:

Informatics 1: Data & Analysis

Introduction to Data Management CSE 344

CSE 344 APRIL 16 TH SEMI-STRUCTURED DATA

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

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

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

Introduction to Database Systems CSE 444

Database Systems CSE 414

Announcements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Introduction to Data Management CSE 344

CSE 544 Principles of Database Management Systems

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

Introduction to Database Systems CSE 414

COURSE OVERVIEW THE RELATIONAL MODEL. CS121: Relational Databases Fall 2017 Lecture 1

Insertions, Deletions, and Updates

COURSE OVERVIEW THE RELATIONAL MODEL. CS121: Introduction to Relational Database Systems Fall 2016 Lecture 1

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

Database Fundamentals Chapter 1

Part I: Structured Data

CMPT 354: Database System I. Lecture 3. SQL Basics

Lecture 16. The Relational Model

Database Systems CSE 414

Chapter 1: Introduction

Database Design Process Entity / Relationship Diagrams

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

Introduction to Database Systems CSE 414

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

Announcements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Database Systems CSE 414

The Relational Data Model

Overview of the Class and Introduction to DB schemas and queries. Lois Delcambre

Relational Databases

CSE 344 APRIL 11 TH DATALOG

Introduction to Data Management CSE 344

user specifies what is wanted, not how to find it

L12: ER modeling 5. CS3200 Database design (sp18 s2) 2/22/2018

EECS 647: Introduction to Database Systems

Database Systems CSE 414

Introduction to Data Management CSE 344

Introduction to Database Systems CSE 344

Introduction to Data Management CSE 344

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

10/18/2017. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414

MTAT Introduction to Databases

Overview of Data Management

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

Database Systems CSE 414

CMPT 354: Database System I. Lecture 1. Course Introduction

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

Overview of Data Management

Introduction to Data Management CSE 344

CSE 344 JANUARY 3 RD - INTRODUCTION

Course Introduction & History of Database Systems

Database Technology Introduction. Heiko Paulheim

CompSci 516 Database Systems. Lecture 2 SQL. Instructor: Sudeepa Roy

Introduction to Data Management CSE 344

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

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

Database Systems CSE 414

Administrivia. The Relational Model. Review. Review. Review. Some useful terms

Lecture 2 SQL. Instructor: Sudeepa Roy. CompSci 516: Data Intensive Computing Systems

CSE 544 Principles of Database Management Systems. Alvin Cheung Fall 2015 Lecture 8 - Data Warehousing and Column Stores

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

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

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

Announcements. Motivating Example. Transaction ROLLBACK. Motivating Example. CSE 444: Database Internals. Lab 2 extended until Monday

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

Database Design Theory and Normalization. CS 377: Database Systems

5/1/17. Announcements. NoSQL Motivation. NoSQL. Serverless Architecture. What is the Problem? Database Systems CSE 414

Introduction to Data Management CSE 344

Relational Model. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan

CSE 344 FEBRUARY 2 ND DATA SEMI-STRUCTURED

Announcements. What is Datalog? Why Do We Learn Datalog? Database Systems CSE 414. Midterm. Datalog. Lecture 13: Datalog (Ch

ECE 650 Systems Programming & Engineering. Spring 2018

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

CS425 Fall 2016 Boris Glavic Chapter 1: Introduction

Transcription:

Announcements Introduction to Databases CSE 414 Lecture 2: Data Models HW1 and WQ1 released Both due next Tuesday Office hours start this week Sections tomorrow Make sure you sign up on piazza Please ask questions! Both online and offline CSE 414 - Spring 2018 1 2 Staff Instructor: Alvin Cheung Office hour on Wednesdays, 1-2pm Using Electronics in Class In the lectures: Opened laptops may disturb neighbors Please sit in the back if you take notes on laptop; pads / surfaces are OK Please don t check your email / youtube / fb In the sections: Always bring your laptop (starting Thursday) From ACM Spring BBQ 15 CSE 414 Spring 2018 3 CSE 414 - Spring 2018 4 Class Overview Unit 1: Intro Unit 2: Relational Data Models and Query Languages Data models, SQL, Relational Algebra, Datalog Unit 3: Non-relational data Unit 4: RDMBS internals and query optimization Unit 5: Parallel query processing Unit 6: DBMS usability, conceptual design Unit 7: Transactions 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 414 - Spring 2018 5 CSE 414 - Spring 2018 6 1

Data Models Recall our example: want to design a database of books: author, title, publisher, pub date, price, etc How should we describe this data? Data model = mathematical formalism (or conceptual way) for describing the data Data Models Relational Data represented as relations Semi-structured (JSon) Data represented as trees -value pairs Used by NoSQL systems Graph Object-oriented Unit 2 Unit 3 CSE 414 - Spring 2018 7 CSE 414 - Spring 2018 8 Example: storing FB friends 3 Elements of Data Models Mary Peter Phil As a graph John Or Person1 Person2 is_friend Peter John 1 John Mary 0 Mary Phil 1 Phil Peter 1 As a relation We will learn the tradeoffs of different data models later this quarter CSE 414 - Spring 2018 9 Instance The actual data Schema Describe what data is being stored Query language How to retrieve and manipulate data CSE 414 - Spring 2018 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 414 - Spring 2018 11 rows / tuples / records Relational Model Data is a collection of relations / tables: mathematically, relation is a set of tuples each tuple appears 0 or 1 times in the table order of the rows is unspecified columns / attributes / fields CSE 414 - Spring 2018 12 2

The Relational Data Model Degree (arity) of a relation = #attributes Each attribute has a type. Examples types: Strings: CHAR(20), VARCHAR(50), TEXT Numbers: INT, SMALLINT, FLOAT MONEY, DATETIME, Few more that are vendor specific Statically and strictly enforced CSE 414 - Spring 2018 13 CSE 414 - Spring 2018 14 Not a key CSE 414 - Spring 2018 15 CSE 414 - Spring 2018 16 Not a key Is this a key? Not a key Is this a key? No: future updates to the database may create duplicate no_employees CSE 414 - Spring 2018 17 CSE 414 - Spring 2018 18 3

Multi-attribute Multiple = fname,lname (what does this mean?) Another key fname lname Income Department Alice Smith 20000 Testing Alice Thompson 50000 Testing Bob Thompson 30000 SW Carol Smith 50000 Testing CSE 414 - Spring 2018 19 SSN fname lname Income Department 111-22-3333 Alice Smith 20000 Testing 222-33-4444 Alice Thompson 50000 Testing 333-44-5555 Bob Thompson 30000 SW 444-55-6666 Carol Smith 50000 Testing We can choose one key and designate it as primary key E.g.: primary key = SSN CSE 414 - Spring 2018 20 Foreign Company(cname, country, no_employees, for_profit) Country(name, population) Foreign key to Company Country.name Canon Japan 50000 Y Hitachi Japan 30000 Y Country name USA Japan population 320M 127M CSE 414 - Spring 2018 21 : Summary = columns that uniquely identify tuple Usually we underline A relation can have many keys, but only one can be chosen as primary key Foreign key: Attribute(s) whose value is a key of a record in some other relation Foreign keys are sometimes called semantic pointer CSE 414 - Spring 2018 22 Query Language SQL Structured Query Language Developed by IBM in the 70s Most widely used language to query relational data Other relational query languages Datalog, relational algebra Our First DBMS SQL Lite Will switch to SQL Server later in the quarter CSE 414 - Spring 2018 23 CSE 414 - Spring 2018 24 4

Demo 1 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 414 - Spring 2018 25 CSE 414 - Spring 2018 26 5