SQLite, Firefox, and our small IMDB movie database. CS3200 Database design (sp18 s2) Version 1/17/2018

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

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

L07: SQL: Advanced & Practice. CS3200 Database design (sp18 s2) 1/11/2018

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

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

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

Please pick up your name card

Lecture 2: Introduction to SQL

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

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

HW1 is due tonight HW2 groups are assigned. Outline today: - nested queries and witnesses - We start with a detailed example! - outer joins, nulls?

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

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

CSE 344 JANUARY 5 TH INTRO TO THE RELATIONAL DATABASE

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

Introduction to Databases CSE 414. Lecture 2: Data Models

Introduction to Database Systems CSE 444

CSE 344 JANUARY 8 TH SQLITE AND JOINS

Lecture 3: SQL Part II

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

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

Introduction to Data Management CSE 414

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

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

In-class activities: Sep 25, 2017

Database Systems CSE 303. Lecture 02

Database Systems CSE 303. Lecture 02

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

Introduction to Database Systems. The Relational Data Model

Introduction to Database Systems. The Relational Data Model. Werner Nutt

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

SQL. Assit.Prof Dr. Anantakul Intarapadung

CSE 154 LECTURE 14: MULTI-TABLE SQL QUERIES (JOINS )

The Relational Data Model

Data Informatics. Seon Ho Kim, Ph.D.

Database Systems CSE 414

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

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

2. E/R Design Considerations

CS 564 Midterm Review

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

CSC 261/461 Database Systems Lecture 7

MTAT Introduction to Databases

SQL. Structured Query Language

CSE 544 Principles of Database Management Systems

CSC 261/461 Database Systems Lecture 6. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101

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

CSC 337. Multi-table SQL Queries (Joins) Rick Mercer, Marty Stepp

COMP 430 Intro. to Database Systems

Introduction to Data Management CSE 344

Principles of Database Systems CSE 544p. Lecture #1 September 28, 2011

Introduction to Relational Databases

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

Setup of PostgreSQL, pgadmin and importing data. CS3200 Database design (sp18 s2) Version 2/9/2018

Lectures 2&3: Introduction to SQL

CSE 544 Principles of Database Management Systems

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

Database design and implementation CMPSCI 645. Lecture 04: SQL and Datalog

PESIT Bangalore South Campus

Step 5 How to download free Music from YouTube You need a YouTube account to download free Music from YouTube. If you don t have a YouTube account,

Lecture 4. Lecture 4: The E/R Model

I know a lot about movies...

Lecture 19 Query Processing Part 1

CSC 337. Database Design and More Commands. Rick Mercer.

Introduction to SQL Part 2 by Michael Hahsler Based on slides for CS145 Introduction to Databases (Stanford)

5/13/2009. Introduction. Introduction. Introduction. Introduction. Introduction

CPSC 504 Background (aka, all you need to know about databases for this course in two lectures) Rachel Pottinger January 8 and 12, 2015

Testing your TLS version

Problem Description Earned Max 1 PHP 25 2 JavaScript / DOM 25 3 Regular Expressions 25 TOTAL Total Points 100. Good luck! You can do it!

CS 474, Spring 2016 Midterm Exam #2

Top 88 Question Asked in Part I of MIS 150 EXAM #1 (Chapter 1-4, Appendix C) Exams questions gathered from old tests dating back to Fall 2000

Entity/Relationship Modelling

Wesleyan University. PeopleSoft - Configuring Web Browser Settings

CS2300: File Structures and Introduction to Database Systems

The Entity-Relationship Model (ER Model) - Part 1

CSE 303: Database. Teaching Staff. Lecture 01. Lectures: 1 st half - from a user s perspective. Lectures: 2 nd half - understanding how it works

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

The Relational Data Model. Data Models. Relational vs Semistructured. Structure Operations - Constraints

Windows Authentication for Velocity Web service Client

Introduction to Data Management CSE 344. Lecture 14: Datalog

CS 338 Nested SQL Queries

NESTED QUERIES AND AGGREGATION CHAPTER 5 (6/E) CHAPTER 8 (5/E)

PES Institute of Technology Bangalore South Campus (1 K.M before Electronic City,Bangalore ) Department of MCA. Solution Set - Test-II

CSE-3421 Test #1 Design

Relational Databases. Relational Databases. SQLite Manager For Firefox.

How to clear a web browsers cache, cookies and history last updated on 8/28/2013

NET-DYN USB Dual Band (Mediatek) Installation Guide. This manual is divided into three parts: Windows XP, Windows 7 / 8 / 8.

Lecture 5. Lecture 5: The E/R Model

SQL: A COMMERCIAL DATABASE LANGUAGE. Data Change Statements,

CS W Introduction to Databases Spring Computer Science Department Columbia University

Introduction to Database Systems

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

COMP 430 Intro. to Database Systems

THE AUSTRALIAN NATIONAL UNIVERSITY. Mid-Semester Examination August 2006 RELATIONAL DATABASES (COMP2400)

FUNCTIONAL DEPENDENCIES CHAPTER , 15.5 (6/E) CHAPTER , 10.5 (5/E)

SAP Workforce Performance Builder 9.5

Introduction to Database Systems. Announcements CSE 444. Review: Closure, Key, Superkey. Decomposition: Schema Design using FD

Relational Databases. Charles Severance

Extending Keyword Search to Metadata in Relational Database

Self-Demo Guide. Oracle ilearning and HTML DB

Transcription:

SQLite, Firefox, and our small IMDB movie database CS3200 Database design (sp18 s2) Version 1/17/2018 1

Overview This document covers 2 issues: How to install SQLite manager in Firefox browser: - SQLite is the most widely used database. For example, Firefox uses it to store your book marks. You are going to install a small tool that allows you to explicitly create and manage a database with Firefox. How to load the small IMDB movie database: I posted a small file that contains subset of data from the IMDB movie website ("300 Small IMDB - SQLite.sql"). You will upload these data into your local version of SQLite and then issues queries over the database. 2

1. Installing SQLite Manager in Firefox 3

SQLite & SQLite Manger Background: http://www.sqlite.org/about.html http://en.wikipedia.org/wiki/sqlite Firefox Plug-in: https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/ 4

How to install SQLite in Firefox Download and install Firefox Download and install SQLite Manager for Firefox Download and connect to small IMDB withsqlite Manager Download Firefox from www.mozilla.org/firefox In newer versions of Firefox, you have to press "ALT" to see the "menu bar". Click on Add-ons Search for "SQLite" in the top right search bar Find and install SQLite Manager Download the following file from our class website: "300 - Small_IMDB_for_SQLite.sql" Start SQLite Manger and follow the instructions on the following pages Start SQLite Manager Menu bar: press ALT Restart Firefox when the installation is done 5

Installing older version of Firefox Firefox version 57 ("Quantum") has disabled some existing add-ons. We thus need to use an older version of Firefox (you can have multiple versions installed in parallel on your machine; use the older version only for class not for browsing the web; only one version can be open at a time) Download version "Firefox 56.0.2 from https://support.mozilla.org/en- US/kb/install-older-version-of-firefox Install older version according to your OS 6

Disable Updates We need to prevent "auto-update" during the installation Turn off the WiFi/ Internet connection. Open old version of Firefox and go to Options. Open Browser and Click on options 7

Scroll to Firefox Updates Select "Never check for updates (not recommended)" Close Firefox and turn Wifi back on. Install the plug-in 8

2. Loading the small IMDB movie database 9

Download the small IMDB movie database Download the small IMDB movie database "300 Small IMDB - SQLite.sql" from our shared folder (see resources) to your computer 10

Importing IMBD movie database (1/4) 1. Start SQLite manager in Firefox under Tools (press "ALT" to see the menu bar) 2. Create a new database. You can call it "Small_IMDB" 11

Importing IMBD movie database (2/4) 1. Start the Import Wizard 3. Select our Small IMDB DB 2. Choose SQL instead of CSV 4. OK 12

Importing IMBD movie database (3/4) By pressing ok, you are executing 4407 SQL commands. How come? 13

Importing IMBD movie database (4/4) Now you can see the 7 newly created tables in the database 1. Type your queries 2. Then Hit "Run SQL" or press "Ctrl + F12" (or "Ctrl + ;" on Win) 3. Your query results will (hopefully) appear 14

More Interesting IMDB queries Execute the following two queries below, just copy and paste to avoid syntax errors ("--" indicates a comment). Can you find alternative interesting queries? -- Find all films which have "Bill" in the name select * from movie where name like '%Bill%'; -- Find all actors and their roles who played in a movie -- with "Bill" in the name select fname, lname, role, name from movie, cast, actor where movie.id = "cast".mid and "cast".aid = actor.id and movie.name like '%Bill%'; The table name "cast" requires quotation marks as it is a protected name in SQLite (but not in SQLserver) 15

Referential Integrity Product PName Price Category Manufacturer Gizmo $19.99 Gadgets GizmoWorks Powergizmo $29.99 Gadgets GizmoWorks SingleTouch $149.99 Photography Canon MultiTouch $203.99 Household Hitachi Company CName StockPrice Country GizmoWorks 25 USA Canon 65 Japan Hitachi 15 Japan Simplified definition Key constraint: minimal subset of the fields of a relation is a unique identier for a tuple. Foreign key: must match field in a relational table that matches a candidate key of another table Gizmo $14.99 Gadgets Hitachi... violates Key constraint SuperTouch $249.99 Computer NewCom... violates Foreign Key constraint 16

Database import: with SQL statements 17

Database import: with SQL statements 18

What is the schema of this simplified Movie Database? Actor id first_name last_name gender Cast aid mid role Movie id name year rank Tables Attributes Actor(id, first_name, last_name, gender) Cast(aid, mid, role) Movie(id, name, year, rank) The schema describes the structure of a database, i.e. tables, attributes, integrity constraints Integrity Constraints (primary keys can also be shown byunderlining) Actor.id, Movie.id = primary keys of the corresponding tables Cast.aid = foreign key to Actor.id Cast.mid = foreign keys to Movie.id 19

More details on the small IMDB schema The data in this database is from the IMDB website. Our small IMDB movie database consists of 7 tables with the following schema: ACTOR (id, fname, lname, gender) MOVIE (id, name, year) DIRECTOR (id, fname, lname) CAST (aid, mid, role) MOVIE_DIRECTOR (did, mid) MOVIE_GENRE (mid, genre) DIRECTOR_GENRE (did, genre,prob) The data we use for this class is only a small subset of the large IMDB movie database, thus you may not be able to find all your favorite movies. But you will find some Quentin Tarantino movies. How many? 20

Small IMDB Movie Database: Schema Movie_genre Movie Movie_director Director mid id did id genre name mid fname year lname rank Cast aid mid role Actor id fname Director_genre did genre prob lname gender 21

Small IMDB Movie Database: Example Tuples Actor id fname lname gender 933 Lewis Abernathy M 2547 Andrew Adamson M............ Director id fname lname 429 Andrew Adamson 2931 Darren Aronofsky......... Director_genre Movie did genre prob id name year rank 429 Adventure 0.75 10920 Aliens 1986 8.2 429 Music 0.25 17173 Animal House 1978 7.5..................... Movie_director did mid 11652 10920 44291 17173...... Movie_genre mid genre 10920 Sci-Fi 10920 Action...... Cast aid mid role 16844 10920 Lydecker 36641 10920 Russ Jorden......... 22