Homework 1: RA, SQL and B+-Trees (due September 24 th, 2014, 2:30pm, in class hard-copy please)

Size: px
Start display at page:

Download "Homework 1: RA, SQL and B+-Trees (due September 24 th, 2014, 2:30pm, in class hard-copy please)"

Transcription

1 Virginia Tech. Computer Science CS 5614 (Big) Data Management Systems Fall 2014, Prakash Homework 1: RA, SQL and B+-Trees (due September 24 th, 2014, 2:30pm, in class hard-copy please) Reminders: a. Out of 100 points. Contains 5 pages. b. Rough time-estimates: 5~8 hours. c. Please type your answers. Illegible handwriting may get no points, at the discretion of the grader. Only drawings may be hand-drawn, as long as they are neat and legible. d. There could be more than one correct answer. We shall accept them all. e. Whenever you are making an assumption, please state it clearly. f. Unless otherwise mentioned, you may use any SQL/RA operator seen in class/in textbook. g. Unless otherwise specified, assume set-semantics for RA and bag-semantics for SQL. h. Feel free to use the linear notation for RA and create intermediate views for SQL (unless otherwise mentioned in the problem). i. Each HW has to be done individually, without taking any help from non-class resources (e.g. websites etc). Q1. RA: Bars [30 points] Consider the following relational database that stores information about bars and customers: Drinker (name, address)! Bar (name, address)! Beer (name, brewer)! Frequents (drinker, bar, times a week) Likes (drinker, beer) Serves (bar, beer, price) Write the following queries in relational algebra: Q1.1. Q1.2. Q1.3. Q1.4. Q1.5. (2 points) Find all drinkers who frequent James Joyce Pub. (2 points) Find all bars that serve both Amstel and Corona. (3 points) Find all bars that serve at least one of the beers Amy likes for no more than $2.50. (3 points) For each bar, find all beers served at this bar that are liked by none of the drinkers who frequent that bar. (5 points) Find all drinkers who frequent only those bars that serve some beers they like. 1

2 Q1.6. Q1.7. (5 points) Find all drinkers who frequent every bar that serves some beers they like. (10 points) Find those drinkers who enjoy exactly the same set of beers as Amy. Q2. SQLite [25 points] This problem will use a database containing data about a university. The relations are in a SQLite database. Download and install SQLite3 from The schema of the database is provided below (keys are in bold, field types are omitted and they could be easily identified using SQLite): student(sid, sname, sex, age, year, gpa) dept(dname, numphds) prof(pname, dname) course(cno, cname, dname) major(dname, sid) section(dname, cno, sectno, pname) enroll(sid, grade, dname, cno, sectno) Before you start, it would be a good idea to take a look at the database file and familiarize yourself with its contents. You can run run this file on SQLite, and the database and tables will be loaded properly. File can be found here: In this assignment, you will only deal with querying part of SQL. You are NOT allowed to tamper with (change the contents of) the database, i.e., CREATE, INSERT, DELETE, ALTER, UPDATE etc. However, please feel free to issue any query-oriented SQL statements, even if they are not related with the questions in this assignment. Queries Write SQL queries that answer the questions below (one query per question) and run them on SQLite. The query answers must not contain duplicates, but you should use the SQL keyword distinct only when necessary. For this question, creation of temporary tables is NOT allowed, i.e., for each question you have to write exactly one SQL statement (possible using nested SQL). Note that it is possible that the answer to some of them may be empty. Q2.1. (2 points) To find the name of the oldest student. 2

3 Q2.2. (2 points) Find the names and gpas of the students who are enrolled in 312. Q2.3. (2 points) Find the names and majors of students who are taking one of the Artificial Intelligence courses. Q2.4. (2 points) Find the names of students who are enrolled in a course from both the "Computer Sciences" and "Chemical Engineering" departments. Q2.5. (3 points) For each department, find the average age of the students majoring in that department along with the age difference between the oldest and youngest students. Q2.6. (3 points) Find the names of students being taught by professor "Jason Singer". Q2.7. (4 points) How many students have more than one major? (Hint: requires a nested query) Q2.8. (4 points) Find the name(s) of the oldest first year student {year = 1} (Hint: requires a nested query) Q2.9. (3 points) For those departments that have no majors taking a "Computer Sciences" course, print the department name and the number of PhD students in the department. Assignment Submission Format your answers as follows (in the hardcopy itself): 1. Query: SQL statement 1 (for query 1); Result: Copy-paste Output for query 1 2. Query: SQL statement 2 (for query 2) Result: Copy-paste Output for query 2.. 3

4 Q3: Crypt-arithmetic [20 points] This exercise is designed to help you think out of the box on the use of database programming for solving problems. You are given the crypt-arithmetic puzzle: SEND + MORE MONEY The goal of the puzzle is to substitute numbers (from zero to nine) for letters, so that the addition works out. There are some constraints your solution should respect: 1. The same number should be used for a given letter, throughout. For example, if you guess, "5" for the letter E, then E should get the value "5" at all the places it occurs. 2. Different letters should get different numbers, e.g., you cannot assign "4" to both E and to M. 3. None of the numbers SEND, MORE, or MONEY have any leading zeroes, i.e., they do not begin with a sequence of zeroes. Explain how you will solve this puzzle by creating database tables and writing a query. Q3.1. (5 points) The schema of the tables you use. Q3.2. (10 points) Your SQL query. Q3.3. (5 points) The solution you get for the puzzle when you use an SQL interpreter and RDBMS to solve this puzzle. Copy-paste the output you get. Hints The SQL query may be quite long so you may find it useful to create the query in a text file and use the source command (or equivalent) in your SQL interpreter to read in and execute the query. Q4: Social Network Friends [10 points] We are in-charge of an online social network MyBook. Consider the relation MyBookFriends(Id, FriendId), which is a giant table for each user on MyBook. The relation MyBookFriends keeps track of all friends of that user. Together, the two attributes comprise the (only) key for this relation. Researchers studying social networks are interested in counting the number of people who have k friends, for every possible value of k. 4

5 (10 points) Write a SQL query that operates on MyBookFriends and returns a relation Counts(NumFriends, NumIds). If this relation stores the tuple (k, l), then it means that there are l distinct users (Id values) in MyBookFriends, each of who has exactly k friends. For no points: imagine you run this query on a real social network like Facebook, and then plot the values with k on the x-axis and l on the y-axis---what is the shape of the plot you expect? Uniform? Linear? Non-linear? Any other particular function? Hints As you can imagine, you do not know beforehand all the different values of k (or l) that should appear in Counts. Hence your SQL query should be able to figure out all these values automatically and correctly. Q5. B+ Tree [15 points] Assume the following B+ tree exists with d = 2: Sketch the state of the B+ tree after each step in the following sequence of insertions and deletions, maintaining at least 50% occupancy at each step and overflow triggered split. In the diagram above we have not shown pointers in the leaf nodes for simplicity but remember that the leaf nodes are linked lists. Note: Use the insertion and deletion algorithms given in the textbook section 10.5 (page 349) and 10.6 (page 353) respectively (also in the Slides). Root node can have 1 to 2d keys. During deletion redistribute the leaf pages wherever possible. Q5.1. (3 points) Insert 34 Q5.2. (3 points) Insert 2 Q5.3. (3 points) Insert 15 Q5.4. (3 points) Delete 28 Q5.5. (3 points) Delete 8 5

Homework 1: RA, SQL and B+-Trees (due Feb 7, 2017, 9:30am, in class hard-copy please)

Homework 1: RA, SQL and B+-Trees (due Feb 7, 2017, 9:30am, in class hard-copy please) Virginia Tech. Computer Science CS 5614 (Big) Data Management Systems Spring 2017, Prakash Homework 1: RA, SQL and B+-Trees (due Feb 7, 2017, 9:30am, in class hard-copy please) Reminders: a. Out of 100

More information

Homework 1: Relational Algebra and SQL (due February 10 th, 2016, 4:00pm, in class hard-copy please)

Homework 1: Relational Algebra and SQL (due February 10 th, 2016, 4:00pm, in class hard-copy please) Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Homework 1: Relational Algebra and SQL (due February 10 th, 2016, 4:00pm, in class hard-copy please) Reminders: a. Out

More information

Homework 2: E/R Models and More SQL (due February 17 th, 2016, 4:00pm, in class hard-copy please)

Homework 2: E/R Models and More SQL (due February 17 th, 2016, 4:00pm, in class hard-copy please) Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Homework 2: E/R Models and More SQL (due February 17 th, 2016, 4:00pm, in class hard-copy please) Reminders: a. Out of

More information

Homework 2: Query Processing/Optimization, Transactions/Recovery (due February 16th, 2017, 9:30am, in class hard-copy please)

Homework 2: Query Processing/Optimization, Transactions/Recovery (due February 16th, 2017, 9:30am, in class hard-copy please) Virginia Tech. Computer Science CS 5614 (Big) Data Management Systems Spring 2017, Prakash Homework 2: Query Processing/Optimization, Transactions/Recovery (due February 16th, 2017, 9:30am, in class hard-copy

More information

Homework 4: Query Processing, Query Optimization (due March 21 st, 2016, 4:00pm, in class hard-copy please)

Homework 4: Query Processing, Query Optimization (due March 21 st, 2016, 4:00pm, in class hard-copy please) Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Homework 4: Query Processing, Query Optimization (due March 21 st, 2016, 4:00pm, in class hard-copy please) Reminders:

More information

Homework 3: Map-Reduce, Frequent Itemsets, LSH, Streams (due March 16 th, 9:30am in class hard-copy please)

Homework 3: Map-Reduce, Frequent Itemsets, LSH, Streams (due March 16 th, 9:30am in class hard-copy please) Virginia Tech. Computer Science CS 5614 (Big) Data Management Systems Spring 2017, Prakash Homework 3: Map-Reduce, Frequent Itemsets, LSH, Streams (due March 16 th, 9:30am in class hard-copy please) Reminders:

More information

Homework 5: Miscellanea (due April 26 th, 2013, 9:05am, in class hard-copy please)

Homework 5: Miscellanea (due April 26 th, 2013, 9:05am, in class hard-copy please) Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2013, Prakash Homework 5: Miscellanea (due April 26 th, 2013, 9:05am, in class hard-copy please) Reminders: a. Out of 100 points. b.

More information

Homework 6: FDs, NFs and XML (due April 15 th, 2015, 4:00pm, hard-copy in-class please)

Homework 6: FDs, NFs and XML (due April 15 th, 2015, 4:00pm, hard-copy in-class please) Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2015, Prakash Homework 6: FDs, NFs and XML (due April 15 th, 2015, 4:00pm, hard-copy in-class please) Reminders: a. Out of 100 points.

More information

Homework 4: Clustering, Recommenders, Dim. Reduction, ML and Graph Mining (due November 19 th, 2014, 2:30pm, in class hard-copy please)

Homework 4: Clustering, Recommenders, Dim. Reduction, ML and Graph Mining (due November 19 th, 2014, 2:30pm, in class hard-copy please) Virginia Tech. Computer Science CS 5614 (Big) Data Management Systems Fall 2014, Prakash Homework 4: Clustering, Recommenders, Dim. Reduction, ML and Graph Mining (due November 19 th, 2014, 2:30pm, in

More information

Homework 6: FDs, NFs and XML (due April 13 th, 2016, 4:00pm, hard-copy in-class please)

Homework 6: FDs, NFs and XML (due April 13 th, 2016, 4:00pm, hard-copy in-class please) Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Homework 6: FDs, NFs and XML (due April 13 th, 2016, 4:00pm, hard-copy in-class please) Reminders: a. Out of 100 points.

More information

1 (10) 2 (8) 3 (12) 4 (14) 5 (6) Total (50)

1 (10) 2 (8) 3 (12) 4 (14) 5 (6) Total (50) Student number: Signature: UNIVERSITY OF VICTORIA Faculty of Engineering Department of Computer Science CSC 370 (Database Systems) Instructor: Daniel M. German Midterm Oct 21, 2004 Duration: 60 minutes

More information

CS 564 Final Exam Fall 2015 Answers

CS 564 Final Exam Fall 2015 Answers CS 564 Final Exam Fall 015 Answers A: STORAGE AND INDEXING [0pts] I. [10pts] For the following questions, clearly circle True or False. 1. The cost of a file scan is essentially the same for a heap file

More information

Homework 2 (by Ao Zeng) Solutions Due: Friday Sept 28, 11:59pm

Homework 2 (by Ao Zeng) Solutions Due: Friday Sept 28, 11:59pm CARNEGIE MELLON UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE 15-445/645 DATABASE SYSTEMS (FALL 2018) PROF. ANDY PAVLO Homework 2 (by Ao Zeng) Solutions Due: Friday Sept 28, 2018 @ 11:59pm IMPORTANT: Upload

More information

Project Assignment 2 (due April 6 th, 2016, 4:00pm, in class hard-copy please)

Project Assignment 2 (due April 6 th, 2016, 4:00pm, in class hard-copy please) Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2016, Prakash Project Assignment 2 (due April 6 th, 2016, 4:00pm, in class hard-copy please) Reminders: a. Out of 100 points. Contains

More information

CS143: Index. Book Chapters: (4 th ) , (5 th ) , , 12.10

CS143: Index. Book Chapters: (4 th ) , (5 th ) , , 12.10 CS143: Index Book Chapters: (4 th ) 12.1-3, 12.5-8 (5 th ) 12.1-3, 12.6-8, 12.10 1 Topics to Learn Important concepts Dense index vs. sparse index Primary index vs. secondary index (= clustering index

More information

Topics to Learn. Important concepts. Tree-based index. Hash-based index

Topics to Learn. Important concepts. Tree-based index. Hash-based index CS143: Index 1 Topics to Learn Important concepts Dense index vs. sparse index Primary index vs. secondary index (= clustering index vs. non-clustering index) Tree-based vs. hash-based index Tree-based

More information

Today s topics. Null Values. Nulls and Views in SQL. Standard Boolean 2-valued logic 9/5/17. 2-valued logic does not work for nulls

Today s topics. Null Values. Nulls and Views in SQL. Standard Boolean 2-valued logic 9/5/17. 2-valued logic does not work for nulls Today s topics CompSci 516 Data Intensive Computing Systems Lecture 4 Relational Algebra and Relational Calculus Instructor: Sudeepa Roy Finish NULLs and Views in SQL from Lecture 3 Relational Algebra

More information

Relational Model & Algebra. Announcements (Thu. Aug. 27) Relational data model. CPS 116 Introduction to Database Systems

Relational Model & Algebra. Announcements (Thu. Aug. 27) Relational data model. CPS 116 Introduction to Database Systems Relational Model & Algebra CPS 116 Introduction to Database Systems Announcements (Thu. Aug. 27) 2 Homework #1 will be assigned next Tuesday Office hours: see also course website Jun: LSRC D327 Tue. 1.5

More information

CSEN 501 CSEN501 - Databases I

CSEN 501 CSEN501 - Databases I CSEN501 - Databases I Lecture 5: Structured Query Language (SQL) Prof. Dr. Slim slim.abdennadher@guc.edu.eg German University Cairo, Faculty of Media Engineering and Technology Structured Query Language:

More information

Announcements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes

Announcements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes Announcements Relational Model & Algebra CPS 216 Advanced Database Systems Lecture notes Notes version (incomplete) available in the morning on the day of lecture Slides version (complete) available after

More information

Project Assignment 2 (due April 6 th, 2015, 4:00pm, in class hard-copy please)

Project Assignment 2 (due April 6 th, 2015, 4:00pm, in class hard-copy please) Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2015, Prakash Project Assignment 2 (due April 6 th, 2015, 4:00pm, in class hard-copy please) Reminders: a. Out of 100 points. Contains

More information

Homework 7: Transactions, Logging and Recovery (due April 22nd, 2015, 4:00pm, in class hard-copy please)

Homework 7: Transactions, Logging and Recovery (due April 22nd, 2015, 4:00pm, in class hard-copy please) Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2015, Prakash Homework 7: Transactions, Logging and Recovery (due April 22nd, 2015, 4:00pm, in class hard-copy please) Reminders: a.

More information

Relational Query Languages

Relational Query Languages Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful, declarative QLs with precise semantics: Strong formal foundation

More information

CS 348 Introduction to Database Management Assignment 2

CS 348 Introduction to Database Management Assignment 2 CS 348 Introduction to Database Management Assignment 2 Due: 30 October 2012 9:00AM Returned: 8 November 2012 Appeal deadline: One week after return Lead TA: Jiewen Wu Submission Instructions: By the indicated

More information

CMU - SCS / Database Applications Spring 2013, C. Faloutsos Homework 1: E.R. + Formal Q.L. Deadline: 1:30pm on Tuesday, 2/5/2013

CMU - SCS / Database Applications Spring 2013, C. Faloutsos Homework 1: E.R. + Formal Q.L. Deadline: 1:30pm on Tuesday, 2/5/2013 CMU - SCS 15-415/15-615 Database Applications Spring 2013, C. Faloutsos Homework 1: E.R. + Formal Q.L. Deadline: 1:30pm on Tuesday, 2/5/2013 Reminders - IMPORTANT: Like all homeworks, it has to be done

More information

EECS 647: Introduction to Database Systems

EECS 647: Introduction to Database Systems EECS 647: Introduction to Database Systems Instructor: Luke Huan Spring 2009 Stating Points A database A database management system A miniworld A data model Conceptual model Relational model 2/24/2009

More information

Lecture 3 More SQL. Instructor: Sudeepa Roy. CompSci 516: Database Systems

Lecture 3 More SQL. Instructor: Sudeepa Roy. CompSci 516: Database Systems CompSci 516 Database Systems Lecture 3 More SQL Instructor: Sudeepa Roy Duke CS, Fall 2018 CompSci 516: Database Systems 1 Announcements HW1 is published on Sakai: Resources -> HW -> HW1 folder Due on

More information

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

Polls on Piazza. Open for 2 days Outline today: Next time: witnesses (traditionally students find this topic the most difficult) L04: SQL 124 Announcements! Polls on Piazza. Open for 2 days Outline today: - practicing more joins and specifying key and FK constraints - nested queries Next time: "witnesses" (traditionally students

More information

CSC 261/461 Database Systems Lecture 19

CSC 261/461 Database Systems Lecture 19 CSC 261/461 Database Systems Lecture 19 Fall 2017 Announcements CIRC: CIRC is down!!! MongoDB and Spark (mini) projects are at stake. L Project 1 Milestone 4 is out Due date: Last date of class We will

More information

Example Examination. Allocated Time: 100 minutes Maximum Points: 250

Example Examination. Allocated Time: 100 minutes Maximum Points: 250 CS542 EXAMPLE EXAM Elke A. Rundensteiner Example Examination Allocated Time: 100 minutes Maximum Points: 250 STUDENT NAME: General Instructions: This test is a closed book exam (besides one cheat sheet).

More information

Announcements (September 14) SQL: Part I SQL. Creating and dropping tables. Basic queries: SFW statement. Example: reading a table

Announcements (September 14) SQL: Part I SQL. Creating and dropping tables. Basic queries: SFW statement. Example: reading a table Announcements (September 14) 2 SQL: Part I Books should have arrived by now Homework #1 due next Tuesday Project milestone #1 due in 4 weeks CPS 116 Introduction to Database Systems SQL 3 Creating and

More information

CS145 Midterm Examination

CS145 Midterm Examination CS145 Midterm Examination Spring 2004, Prof. Widom Please read all instructions (including these) carefully. There are 9 problems on the exam, with a varying number of points for each problem and subproblem

More information

CS425 Midterm Exam Summer C 2012

CS425 Midterm Exam Summer C 2012 Q1) List five responsibilities of a database-management system. Q2) Fill in the terms in the right hand side of the table that match the description from the list below: Instance SQL Integrity constraints

More information

Lecture 3 SQL - 2. Today s topic. Recap: Lecture 2. Basic SQL Query. Conceptual Evaluation Strategy 9/3/17. Instructor: Sudeepa Roy

Lecture 3 SQL - 2. Today s topic. Recap: Lecture 2. Basic SQL Query. Conceptual Evaluation Strategy 9/3/17. Instructor: Sudeepa Roy CompSci 516 Data Intensive Computing Systems Lecture 3 SQL - 2 Instructor: Sudeepa Roy Announcements HW1 reminder: Due on 09/21 (Thurs), 11:55 pm, no late days Project proposal reminder: Due on 09/20 (Wed),

More information

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

Lecture 2 SQL. Instructor: Sudeepa Roy. CompSci 516: Data Intensive Computing Systems CompSci 516 Data Intensive Computing Systems Lecture 2 SQL Instructor: Sudeepa Roy Duke CS, Spring 2016 CompSci 516: Data Intensive Computing Systems 1 Announcement If you are enrolled to the class, but

More information

Announcements (September 18) SQL: Part II. Solution 1. Incomplete information. Solution 3? Solution 2. Homework #1 due today (11:59pm)

Announcements (September 18) SQL: Part II. Solution 1. Incomplete information. Solution 3? Solution 2. Homework #1 due today (11:59pm) Announcements (September 18) 2 SQL: Part II Homework #1 due today (11:59pm) Submit in class, slide underneath my office door Sample solution available Thursday Homework #2 assigned today CPS 116 Introduction

More information

CompSci 516: Database Systems

CompSci 516: Database Systems CompSci 516 Database Systems Lecture 4 Relational Algebra and Relational Calculus Instructor: Sudeepa Roy Duke CS, Fall 2018 CompSci 516: Database Systems 1 Reminder: HW1 Announcements Sakai : Resources

More information

What s a database system? Review of Basic Database Concepts. Entity-relationship (E/R) diagram. Two important questions. Physical data independence

What s a database system? Review of Basic Database Concepts. Entity-relationship (E/R) diagram. Two important questions. Physical data independence What s a database system? Review of Basic Database Concepts CPS 296.1 Topics in Database Systems According to Oxford Dictionary Database: an organized body of related information Database system, DataBase

More information

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

DS Introduction to SQL Part 2 Multi-table Queries. By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford) DS 1300 - Introduction to SQL Part 2 Multi-table Queries By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford) What you will learn about in this section 1. Foreign key constraints

More information

Query Processing & Optimization. CS 377: Database Systems

Query Processing & Optimization. CS 377: Database Systems Query Processing & Optimization CS 377: Database Systems Recap: File Organization & Indexing Physical level support for data retrieval File organization: ordered or sequential file to find items using

More information

Chapter 6 The database Language SQL as a tutorial

Chapter 6 The database Language SQL as a tutorial Chapter 6 The database Language SQL as a tutorial About SQL SQL is a standard database language, adopted by many commercial systems. ANSI SQL, SQL-92 or SQL2, SQL99 or SQL3 extends SQL2 with objectrelational

More information

CSC 261/461 Database Systems Lecture 13. Fall 2017

CSC 261/461 Database Systems Lecture 13. Fall 2017 CSC 261/461 Database Systems Lecture 13 Fall 2017 Announcement Start learning HTML, CSS, JavaScript, PHP + SQL We will cover the basics next week https://www.w3schools.com/php/php_mysql_intro.asp Project

More information

University of California, Berkeley. CS 186 Introduction to Databases, Spring 2014, Prof. Dan Olteanu MIDTERM

University of California, Berkeley. CS 186 Introduction to Databases, Spring 2014, Prof. Dan Olteanu MIDTERM University of California, Berkeley CS 186 Introduction to Databases, Spring 2014, Prof. Dan Olteanu MIDTERM This is a closed book examination sided). but you are allowed one 8.5 x 11 sheet of notes (double

More information

Chapter 6 The database Language SQL as a tutorial

Chapter 6 The database Language SQL as a tutorial Chapter 6 The database Language SQL as a tutorial About SQL SQL is a standard database language, adopted by many commercial systems. ANSI SQL, SQL-92 or SQL2, SQL99 or SQL3 extends SQL2 with objectrelational

More information

SQL: Part II. Announcements (September 18) Incomplete information. CPS 116 Introduction to Database Systems. Homework #1 due today (11:59pm)

SQL: Part II. Announcements (September 18) Incomplete information. CPS 116 Introduction to Database Systems. Homework #1 due today (11:59pm) SQL: Part II CPS 116 Introduction to Database Systems Announcements (September 18) 2 Homework #1 due today (11:59pm) Submit in class, slide underneath my office door Sample solution available Thursday

More information

Introduction to Data Management. Lecture #4 (E-R Relational Translation)

Introduction to Data Management. Lecture #4 (E-R Relational Translation) Introduction to Data Management Lecture #4 (E-R Relational Translation) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Today

More information

VIEW OTHER QUESTION PAPERS

VIEW OTHER QUESTION PAPERS VIEW OTHER QUESTION PAPERS E B4E0562 Reg No.: Name: Total Pages: 2 APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY FOURTH SEMESTER B.TECH DEGREE EXAMINATION, JULY 2017 Course Code: CS208 Course Name: PRINCIPLES

More information

Carnegie Mellon University Department of Computer Science /615 - Database Applications C. Faloutsos & A. Pavlo, Spring 2014.

Carnegie Mellon University Department of Computer Science /615 - Database Applications C. Faloutsos & A. Pavlo, Spring 2014. Carnegie Mellon University Department of Computer Science 15-415/615 - Database Applications C. Faloutsos & A. Pavlo, Spring 2014 Homework 1 IMPORTANT Plagiarism: Homework may be discussed with other students,

More information

Relational Algebra for sets Introduction to relational algebra for bags

Relational Algebra for sets Introduction to relational algebra for bags Relational Algebra for sets Introduction to relational algebra for bags Thursday, September 27, 2012 1 1 Terminology for Relational Databases Slide repeated from Lecture 1... Account Number Owner Balance

More information

Introduction to SQL Part 1 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) Introduction to SQL Part 1 By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford) Lecture 2 Lecture Overview 1. SQL introduction & schema definitions 2. Basic single-table queries

More information

CS 245 Midterm Exam Solution Winter 2015

CS 245 Midterm Exam Solution Winter 2015 CS 245 Midterm Exam Solution Winter 2015 This exam is open book and notes. You can use a calculator and your laptop to access course notes and videos (but not to communicate with other people). You have

More information

Database Design. Goal: specification of database schema Methodology:

Database Design. Goal: specification of database schema Methodology: Database Design Goal: specification of database schema Methodology: Use E-R model to get a high-level graphical view of essential components of the model and how they are related Convert E-R diagram to

More information

9/8/2018. Prerequisites. Grading. People & Contact Information. Textbooks. Course Info. CS430/630 Database Management Systems Fall 2018

9/8/2018. Prerequisites. Grading. People & Contact Information. Textbooks. Course Info. CS430/630 Database Management Systems Fall 2018 CS430/630 Database Management Systems Fall 2018 People & Contact Information Instructor: Prof. Betty O Neil Email: eoneil AT cs DOT umb DOT edu (preferred contact) Web: http://www.cs.umb.edu/~eoneil Office:

More information

The Relational Model of Data (ii)

The Relational Model of Data (ii) ICS 321 Fall 2013 The Relational Model of Data (ii) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1 Defining Relational Schema in SQL Two aspects: Data

More information

Review. The Relational Model. Glossary. Review. Data Models. Why Study the Relational Model? Why use a DBMS? OS provides RAM and disk

Review. The Relational Model. Glossary. Review. Data Models. Why Study the Relational Model? Why use a DBMS? OS provides RAM and disk Review The Relational Model CS 186, Fall 2006, Lecture 2 R & G, Chap. 3 Why use a DBMS? OS provides RAM and disk Review Why use a DBMS? OS provides RAM and disk Concurrency Recovery Abstraction, Data Independence

More information

Relational Model and Relational Algebra

Relational Model and Relational Algebra Relational Model and Relational Algebra CMPSCI 445 Database Systems Fall 2008 Some slide content courtesy of Zack Ives, Ramakrishnan & Gehrke, Dan Suciu, Ullman & Widom Next lectures: Querying relational

More information

Lecture 16. The Relational Model

Lecture 16. The Relational Model Lecture 16 The Relational Model Lecture 16 Today s Lecture 1. The Relational Model & Relational Algebra 2. Relational Algebra Pt. II [Optional: may skip] 2 Lecture 16 > Section 1 1. The Relational Model

More information

SQL - Lecture 3 (Aggregation, etc.)

SQL - Lecture 3 (Aggregation, etc.) SQL - Lecture 3 (Aggregation, etc.) INFS 614 INFS614 1 Example Instances S1 S2 R1 sid bid day 22 101 10/10/96 58 103 11/12/96 sid sname rating age 22 dustin 7 45.0 31 lubber 8 55.5 58 rusty 10 35.0 sid

More information

Score. 1 (10) 2 (10) 3 (8) 4 (13) 5 (9) Total (50)

Score. 1 (10) 2 (10) 3 (8) 4 (13) 5 (9) Total (50) Student number: Signature: UNIVERSITY OF VICTORIA Faculty of Engineering Department of Computer Science CSC 370 (Database Systems) Instructor: Daniel M. German Midterm 18 June 2003 Duration: 75 minutes

More information

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #3: SQL and Rela2onal Algebra- - - Part 1

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #3: SQL and Rela2onal Algebra- - - Part 1 CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #3: SQL and Rela2onal Algebra- - - Part 1 Reminder: Rela0onal Algebra Rela2onal algebra is a nota2on for specifying queries

More information

4/10/2018. Relational Algebra (RA) 1. Selection (σ) 2. Projection (Π) Note that RA Operators are Compositional! 3.

4/10/2018. Relational Algebra (RA) 1. Selection (σ) 2. Projection (Π) Note that RA Operators are Compositional! 3. Lecture 33: The Relational Model 2 Professor Xiannong Meng Spring 2018 Lecture and activity contents are based on what Prof Chris Ré of Stanford used in his CS 145 in the fall 2016 term with permission

More information

SQL: Part III. Announcements. Constraints. CPS 216 Advanced Database Systems

SQL: Part III. Announcements. Constraints. CPS 216 Advanced Database Systems SQL: Part III CPS 216 Advanced Database Systems Announcements 2 Reminder: Homework #1 due in 12 days Reminder: reading assignment posted on Web Reminder: recitation session this Friday (January 31) on

More information

SQL. The Basics Advanced Manipulation Constraints Authorization 1. 1

SQL. The Basics Advanced Manipulation Constraints Authorization 1. 1 SQL The Basics Advanced Manipulation Constraints Authorization 1. 1 Table of Contents SQL 0 Table of Contents 0/1 Parke Godfrey 0/2 Acknowledgments 0/3 SQL: a standard language for accessing databases

More information

Homework 6. Question Points Score Query Optimization 20 Functional Dependencies 20 Decompositions 30 Normal Forms 30 Total: 100

Homework 6. Question Points Score Query Optimization 20 Functional Dependencies 20 Decompositions 30 Normal Forms 30 Total: 100 Carnegie Mellon University Department of Computer Science 15-415/615- Database Applications C. Faloutsos & A. Pavlo, Spring 2015 Prepared by Vinay & Jiayu DUE DATE: Tuesday, 3/24/2015, 1:30pm Homework

More information

Database Management Systems. Chapter 3 Part 1

Database Management Systems. Chapter 3 Part 1 Database Management Systems Chapter 3 Part 1 The Relational Model Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Why Study the Relational Model? Most widely used model. Vendors: IBM,

More information

Introduction to Data Management. Lecture #5 Relational Model (Cont.) & E-Rà Relational Mapping

Introduction to Data Management. Lecture #5 Relational Model (Cont.) & E-Rà Relational Mapping Introduction to Data Management Lecture #5 Relational Model (Cont.) & E-Rà Relational Mapping Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

More information

SQL - Data Query language

SQL - Data Query language SQL - Data Query language Eduardo J Ruiz October 20, 2009 1 Basic Structure The simple structure for a SQL query is the following: select a1...an from t1... tr where C Where t 1... t r is a list of relations

More information

Database Management Systems (COP 5725) Homework 3

Database Management Systems (COP 5725) Homework 3 Database Management Systems (COP 5725) Homework 3 Instructor: Dr. Daisy Zhe Wang TAs: Yang Chen, Kun Li, Yang Peng yang, kli, ypeng@cise.uf l.edu November 26, 2013 Name: UFID: Email Address: Pledge(Must

More information

Lesson 18: There is Only One Line Passing Through a Given Point with a Given

Lesson 18: There is Only One Line Passing Through a Given Point with a Given Lesson 18: There is Only One Line Passing Through a Given Point with a Given Student Outcomes Students graph equations in the form of using information about slope and intercept. Students know that if

More information

1. (a) Briefly explain the Database Design process. (b) Define these terms: Entity, Entity set, Attribute, Key. [7+8] FIRSTRANKER

1. (a) Briefly explain the Database Design process. (b) Define these terms: Entity, Entity set, Attribute, Key. [7+8] FIRSTRANKER Code No: R09220502 R09 Set No. 2 1. (a) Briefly explain the Database Design process. (b) Define these terms: Entity, Entity set, Attribute, Key. [7+8] 2. Explain schema refinement in Database Design? [15]

More information

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall The Relational Model Chapter 3 Comp 521 Files and Databases Fall 2012 1 Why Study the Relational Model? Most widely used model by industry. IBM, Informix, Microsoft, Oracle, Sybase, etc. It is simple,

More information

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE COMP 62421 Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Querying Data on the Web Date: Wednesday 24th January 2018 Time: 14:00-16:00 Please answer all FIVE Questions provided. They amount

More information

COMP 244 DATABASE CONCEPTS AND APPLICATIONS

COMP 244 DATABASE CONCEPTS AND APPLICATIONS COMP 244 DATABASE CONCEPTS AND APPLICATIONS Relational Algebra And Calculus 1 Relational Algebra A formal query language associated with the relational model. Queries in ALGEBRA are composed using a collection

More information

CSE 344 JANUARY 5 TH INTRO TO THE RELATIONAL DATABASE

CSE 344 JANUARY 5 TH INTRO TO THE RELATIONAL DATABASE CSE 344 JANUARY 5 TH INTRO TO THE RELATIONAL DATABASE ADMINISTRATIVE MINUTIAE Midterm Exam: February 9 th : 3:30-4:20 Final Exam: March 15 th : 2:30 4:20 ADMINISTRATIVE MINUTIAE Midterm Exam: February

More information

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

CMPT 354: Database System I. Lecture 3. SQL Basics CMPT 354: Database System I Lecture 3. SQL Basics 1 Announcements! About Piazza 97 enrolled (as of today) Posts are anonymous to classmates You should have started doing A1 Please come to office hours

More information

CS 4320/5320 Homework 2

CS 4320/5320 Homework 2 CS 4320/5320 Homework 2 Fall 2017 Due on Friday, 20th of October 2017 at 11:59 pm This assignment is out of 75 points and accounts for 10% of your overall grade. All answers for this homework should be

More information

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Thursday 16th January 2014 Time: 09:45-11:45. Please answer BOTH Questions

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Thursday 16th January 2014 Time: 09:45-11:45. Please answer BOTH Questions Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Advanced Database Management Systems Date: Thursday 16th January 2014 Time: 09:45-11:45 Please answer BOTH Questions This is a CLOSED book

More information

Lecture 2: Introduction to SQL

Lecture 2: Introduction to SQL Lecture 2: Introduction to SQL Lecture 2 Announcements! 1. If you still have Jupyter trouble, let us know! 2. Enroll to Piazza!!! 3. People are looking for groups. Team up! 4. Enrollment should be finalized

More information

CS143: Relational Model

CS143: Relational Model CS143: Relational Model Book Chapters (4th) Chapters 1.3-5, 3.1, 4.11 (5th) Chapters 1.3-7, 2.1, 3.1-2, 4.1 (6th) Chapters 1.3-6, 2.105, 3.1-2, 4.5 Things to Learn Data model Relational model Database

More information

Database Systems ( 資料庫系統 )

Database Systems ( 資料庫系統 ) Database Systems ( 資料庫系統 ) 9.28.2011 Lecture #3 1 Course Administration Please download HW #1 from course homepage It is due 10/12/2011. This lecture: R&G Chapter 3 Next week reading: R&G Chapter 41~ 4.1

More information

IMPORTANT: Circle the last two letters of your class account:

IMPORTANT: Circle the last two letters of your class account: Spring 2011 University of California, Berkeley College of Engineering Computer Science Division EECS MIDTERM I CS 186 Introduction to Database Systems Prof. Michael J. Franklin NAME: STUDENT ID: IMPORTANT:

More information

Lecture 2 SQL. Announcements. Recap: Lecture 1. Today s topic. Semi-structured Data and XML. XML: an overview 8/30/17. Instructor: Sudeepa Roy

Lecture 2 SQL. Announcements. Recap: Lecture 1. Today s topic. Semi-structured Data and XML. XML: an overview 8/30/17. Instructor: Sudeepa Roy Announcements CompSci 516 Data Intensive Computing Systems Lecture 2 SQL Instructor: Sudeepa Roy If you are enrolled to the class, but have not received the email from Piazza, please send me an email All

More information

COMP 430 Intro. to Database Systems

COMP 430 Intro. to Database Systems COMP 430 Intro. to Database Systems Multi-table SQL Get clickers today! Slides use ideas from Chris Ré and Chris Jermaine. The need for multiple tables Using a single table leads to repeating data Provides

More information

Announcements (September 21) SQL: Part III. Triggers. Active data. Trigger options. Trigger example

Announcements (September 21) SQL: Part III. Triggers. Active data. Trigger options. Trigger example Announcements (September 21) 2 SQL: Part III CPS 116 Introduction to Database Systems Homework #2 due next Thursday Homework #1 sample solution available today Hardcopies only Check the handout box outside

More information

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall The Relational Model Chapter 3 Comp 521 Files and Databases Fall 2014 1 Why the Relational Model? Most widely used model by industry. IBM, Informix, Microsoft, Oracle, Sybase, MySQL, Postgres, Sqlite,

More information

Relational Model & Algebra. Announcements (Tue. Sep. 3) Relational data model. CompSci 316 Introduction to Database Systems

Relational Model & Algebra. Announcements (Tue. Sep. 3) Relational data model. CompSci 316 Introduction to Database Systems Relational Model & Algebra CompSci 316 Introduction to Database Systems Announcements (Tue. Sep. 3) Homework #1 has been posted Sign up for Gradiance now! Windows Azure passcode will be emailed soon sign

More information

CSIT5300: Advanced Database Systems

CSIT5300: Advanced Database Systems CSIT5300: Advanced Database Systems E10: Exercises on Query Processing Dr. Kenneth LEUNG Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong SAR,

More information

Modern Database Systems Lecture 1

Modern Database Systems Lecture 1 Modern Database Systems Lecture 1 Aristides Gionis Michael Mathioudakis T.A.: Orestis Kostakis Spring 2016 logistics assignment will be up by Monday (you will receive email) due Feb 12 th if you re not

More information

Midterm Exam. Name: CSE232A, Winter February 21, Brief Directions:

Midterm Exam. Name: CSE232A, Winter February 21, Brief Directions: Midterm Exam CSE232A, Winter 2002 February 21, 2002 Name: Brief Directions: ² Write clearly: First, you don't want me to spend the whole week grading, do you? Second, it's good for you to write clearly!

More information

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

Data! CS 133: Databases. Goals for Today. So, what is a database? What is a database anyway? From the textbook: CS 133: Databases Fall 2018 Lec 01 09/04 Introduction & Relational Model Data! Need systems to Data is everywhere Banking, airline reservations manage the data Social media, clicking anything on the internet

More information

CS2300: File Structures and Introduction to Database Systems

CS2300: File Structures and Introduction to Database Systems CS2300: File Structures and Introduction to Database Systems Lecture 9: Relational Model & Relational Algebra Doug McGeehan 1 Brief Review Relational model concepts Informal Terms Formal Terms Table Relation

More information

The Relational Data Model. Data Model

The Relational Data Model. Data Model The Relational Data Model Davood Rafiei *Disclaimer: The slides used in the course may contain some of the slides provided by the authors of the adopted textbook (present and past) and those used in previous

More information

CSE 444, Winter 2011, Midterm Examination 9 February 2011

CSE 444, Winter 2011, Midterm Examination 9 February 2011 Name: CSE 444, Winter 2011, Midterm Examination 9 February 2011 Rules: Open books and open notes. No laptops or other mobile devices. Please write clearly. Relax! You are here to learn. An extra page is

More information

GUJARAT TECHNOLOGICAL UNIVERSITY

GUJARAT TECHNOLOGICAL UNIVERSITY Seat No.: Enrolment No. GUJARAT TECHNOLOGICAL UNIVERSITY BE - SEMESTER III (NEW) - EXAMINATION SUMMER 2017 Subject Code: 21303 Date: 02/06/2017 Subject Name: Database Management Systems Time: 10:30 AM

More information

Chapter 3: Introduction to SQL. Chapter 3: Introduction to SQL

Chapter 3: Introduction to SQL. Chapter 3: Introduction to SQL Chapter 3: Introduction to SQL Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 3: Introduction to SQL Overview of The SQL Query Language Data Definition Basic Query

More information

CS 582 Database Management Systems II

CS 582 Database Management Systems II Review of SQL Basics SQL overview Several parts Data-definition language (DDL): insert, delete, modify schemas Data-manipulation language (DML): insert, delete, modify tuples Integrity View definition

More information

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE Querying Data on the Web Date: Wednesday 27th January 2016 Time: 09:45-11:45 Please answer ALL Questions provided This is a CLOSED book examination

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) The Relational Model Lecture 3, January 18, 2015 Mohammad Hammoud Today Last Session: The entity relationship (ER) model Today s Session: ER model (Cont d): conceptual design

More information

CS 202, Fall 2017 Homework #4 Balanced Search Trees and Hashing Due Date: December 18, 2017

CS 202, Fall 2017 Homework #4 Balanced Search Trees and Hashing Due Date: December 18, 2017 CS 202, Fall 2017 Homework #4 Balanced Search Trees and Hashing Due Date: December 18, 2017 Important Notes Please do not start the assignment before reading these notes. Before 23:55, December 18, upload

More information

The Relational Model. Week 2

The Relational Model. Week 2 The Relational Model Week 2 1 Relations A relation is a more concrete construction, of something we have seen before, the ER diagram. name S.S.N students street city A relation is (just!) a table! We will

More information