CS 200 Fall 2012 Assignment 8 SQL Due Monday November 10 by 4:00 pm

Similar documents
CS200 Assignment 9 FileMaker Due Monday November 18th 4:00 pm

CS 200. Lecture 09 FileMaker vs SQL & Reports. FileMaker vs SQL + Reports. CS 200 Spring 2018

Practice for Test 1 (not counted for credit, but to help you prepare) Time allowed: 1 hour 15 minutes

CS 348 Introduction to Database Management Assignment 2

X. Query Optimization

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "

CS 200. Lecture 05. Database Introduction. Database Introduction. CS 200 Spring Monday, June 3, 2013

2. Key the titles in cells A1 to D1, adjust to size 12, click on the bold button, and format with an underline.

Student Manual. Cognos Analytics

Course No: 4411 Database Management Systems Fall 2008 Midterm exam

Creating User-Friendly Databases

Using Respondus with D2L

1. Select a cell in the column you want to sort by. In this example, we will sort by Last Name.

CS 200. Lecture 06. Database Introduction. Database Introduction. CS 200 Winter 2018

Review The Big Picture

Process Document Creating a Query with Runtime Prompts. Creating a Query with Runtime Prompts. Concept

1. Textbook #1: Our Digital World (ODW). 2. Textbook #2: Guidelines for Office 2013 (GFO). 3. SNAP: Assessment Software

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

Database Concepts Using Microsoft Access

Database Management Systems MIT Introduction By S. Sabraz Nawaz

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

VETtrak Data Insights User Guide. for VETtrak version

INSTRUCTOR SELF SERVICE USER GUIDE

User Guide. Web Intelligence Rich Client. Business Objects 4.1

CSE 530 Midterm Exam

Contents 1. Accessing Microsoft Stream Uploading your video to My content area Deleting your video Sharing your video...

CS10001: Computer Literacy Lab Assignment #3, Part #2

RELEASE NOTES. Epic Offline Client Messaging 3. My Account 11. Announcement 12. Discussion Board 13. Exam 14.

proj 3B intro to multi-page layout & interactive pdf

download instant at The Relational Data Model

Name: Database Systems ( 資料庫系統 ) Midterm exam, November 15, 2006

Designing Adhoc Reports

HOMEWORK 8. M. Neumann. Due: THU 29 MAR PM. Getting Started SUBMISSION INSTRUCTIONS

Step 1. Final Grade Roster Submission. IT Department Printed on 05/21/2012 Page 1. Steps to Submit Grades. Step 1. Step 2. Step 3

Oracle Database 10g Express

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

This is a two week homework; it is twice as long as usual. You should complete the first half of it by November 6.

Some (semi-)advanced tips for LibreOffice

CS40 Exam #2 November 13, 2002

Microsoft Access 2010

CSE 344 Midterm. Wednesday, February 19, 2014, 14:30-15:20. Question Points Score Total: 100

Microsoft Office Word 2013

User's Guide c-treeace SQL Explorer

Join Queries in Cognos Analytics Reporting

eschoolplus+ Cognos Query Studio Training Guide Version 2.4

Microsoft Access 2013

Microsoft Access 2013

How to design and print cards using a database connection with. emedia CS Software

Week 5 Creating a Calendar. About Tables. Making a Calendar From a Table Template. Week 5 Word 2010

Blackboard 5. Instructor Manual Level One Release 5.5

General Assignment Scheduling Compliance Dashboard Functional Documentation Latest update: 1/13/2016 by Wood Foster- Smith

CONTENT. 1.0 Introduction Downloading and installing the software Running the software Using the software 7

CS 186 Midterm, Spring 2003 Page 1

Contra Costa CurricUNET User Manual

MANAGING SIMS.NET USERS, AND ALLOCATING TO PERMISSION GROUPS

Logi Ad Hoc Reporting System Administration Guide

1. Managing Information in Table

Managed Reporting Environment

Access Review. 4. Save the table by clicking the Save icon in the Quick Access Toolbar or by pulling

PM4 + Partners Knowledge Articles

UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division

Student Manual. Cognos Analytics

Logi Ad Hoc Reporting System Administration Guide

Furniture Reporting Updated July 2016

Basic Software Maintenance. Ham Station Ultra Software Package

SECTION 1 DBMS LAB 1.0 INTRODUCTION 1.1 OBJECTIVES 1.2 INTRODUCTION TO MS-ACCESS. Structure Page No.

Chapter 8 Relational Tables in Microsoft Access

Bold with the Dialog Box Launcher. Locate MS Office and open Word.

GUJARAT TECHNOLOGICAL UNIVERSITY

Creating a Crosstab Query in Design View

CS211 Lecture: Database Querying and Updating

SOFTWARE SKILLS BUILDERS

Campus Solutions Self Service: Faculty Quick Reference Guide

Linking Program Review Data to Reports

Page Gentics Software GmbH Enterprise Portals and Content Management Systems

SIS Modernization Faculty Portal Training Guide

Basics of Project Sites

1. Textbook #1: Our Digital World (ODW). 2. Textbook #2: Guidelines for Office 2013 (GFO). 3. SNAP: Assessment Software

Each time you start PastPerfect you will be presented with the main menu.

Les s on Objectives. Student Files Us ed. Student Files Crea ted

How to turn on the computer: How to log on to the TC network: How to use the mouse: Essential Computer Skills

SIS Import Guide. v2015.1

Introduction to Timetabling and Facility CMIS

Introductory Exercises in Microsoft Access XP

Introduction to Cognos Participants Guide. Table of Contents: Guided Instruction Overview of Welcome Screen 2

VERSION DOCUMENT TRACKING USER MANUAL

Add Bullets and Numbers

SEP Evaluation Expert Quick Guide

SEE GRADING CRITERIA AT THE BOTTOM. Database Tables Lookup Wizard Relationships Forms Queries Reports

Lab 3. A Multi-Message Reader

Database Security MET CS 674 On-Campus/Blended

Contents. Project One. Introduction to Microsoft Windows XP and Office Creating and Editing a Word Document. Microsoft Word 2003

Introduction to Microsoft Access 2016

Create a new form. To create a form from a new or existing spreadsheet: 1. Click the Tools drop down menu and select Create a form.

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

Basic Reports & Dashboards

GEO 425: SPRING 2012 LAB 9: Introduction to Postgresql and SQL

Your Name: Section: INTRODUCTION TO STATISTICAL REASONING Computer Lab #4 Scatterplots and Regression

Information Services. Essential Access Exercises. IT

Auto Mechanics Local 701. Online Remittance Processing Instructions

Transcription:

CS 200 Fall 2012 Assignment 8 SQL Due Monday November 10 by 4:00 pm Read Notes 6, in particular Database Design and Watcom SQL User s Guide. Please follow these instructions very carefully to find the files and programs you need. Open Macintosh HD : Users : Shared 1) Within this folder you must create a new folder labeled yhc. 2) It is within this folder that you must drag the contents of the universitytables folder, in which the university.db is located. The folder contents to copy can be found in cs200 : cs200 Public : Files For SQL : For the Assignment : universitytables 3) The permissions on the yhc folder need to be changed so that you, as the owner, have both read and write privileges. In addition, change the group and others so that they have no access. Now you have a copy of the university.db on your local machine. 4) In the Applications folder on Macintosh HD, find the SQLAnywhere10 folder 5) Start DBLauncher. 6) When prompted, browse to find your university.db file and click start. Click yes on the window that follows. 7) Your database is now running. Go back to the SQLAnywhere10 folder and start Interactive SQL. 8) Under the Identification tab, input the following. UserID : dba Password : sql 9) Under the Database tab, input the name University into the database name field and browse to find your university.db file. 10) Click OK 11) The dialog box should disappear without any errors. You are now ready to send requests. When you are finished working with SQL, quit the DB launcher first and then quit the InteractiveSQL. DB Launcher starts the database server and allows you to open university.db InteractiveSQL allows you to enter and execute SQL commands from a command window. CS 200 SQL Page 1

You may work on question 1 with a partner. If you do, be certain that you both understand all of what you have done. The purpose of allowing you to work in groups is to enable you to help each other understand the assignment, not to enable you to divide up the work. 1. Copy the file cs200 : cs200 Public : Files For SQL : For the Assignment : Assign8.doc to your cs200main network disk on Oscar twice and rename one yhc_sql_q1.doc or (yhc1_yhc2_sql_q1.doc if you are working in pair) and the other yhc_sql_q2.doc (feel free to delete the parts not relevant to the specified question). Using MS Word, insert your input and/or output after each sub-question when asked. Please format your answers with the styles AnswerTop,Answer, AnswerBot, and SQL_Output (for tabular SQL output, where requested), which are already in Assign7.doc 1. Approximately 7% of the marks for this question are reserved for proper formatting of your answer within Assign8.doc. [75%] In InteractiveSQL create the appropriate statements to answer the queries below: a) What SQL statement would you use to list the courses known to the database? b) What SQL statement would you use to list the student numbers of people taking Algebra? c) What SQL statement would you use to list the student numbers and names of students taking Algebra, ordered by surname? d) What SQL statement would you use to count the number of students taking Algebra? (And what is the answer?) e) What SQL statement would you use to list the assignments (and exams) for Algebra? (Please include the output, formatted as a table.) f) What SQL statement would you use to list the student number, course code, assignment number, assignment description, assignment weight, and mark for all the Calculus marks for the student with ID 86088? (Please include the output, formatted as a table.) g) What SQL statement would you use to compute the course mark in Calculus for the student with ID 86088? (And what is the answer?) h) What SQL statement would you use to list the course marks for students in Calculus? (Please include the first ten lines of the answer, formatted as a table.) i) What SQL Select statement would you use to compute the course mark in Calculus, for students who also took Algebra? (Please include the output, formatted as a table.) Bonus (5 marks) j) What SQL statement would you use to determine if there is more than one student with the same last name in the database? List the people in alphabetical order (first name) only once. 2 1 Use AnswerTop for the first line of a prose answer it has a little more before leading and Answer for the rest except for the paragraph just before a table, for which AnswerBot is appropriate because it adds a bit of extra leading after the paragraph (and before the table). 2 Hint: Make sure that the names that are duplicated are displayed with the first initials. CS 200 SQL Page 2

The following questions must be done independently. 2. [15%] Consider the Albums database we discussed in lecture, as shown to the right. Suppose we wish to keep track of the artists who appear on the albums in our collection, and record biographical information about them. Clearly we need an Artists table like the one shown below the Albums Table. a) Explain why these two tables cannot be joined as they are and explain how a third table, with exactly two fields, could record which albums each artist appears on. You should provide a diagram of this table based on the fields of the Album and Artists tables shown here, and you should provide information about its primary and foreign keys. Your answer should also include an explanation of how each of the following problems are solved: i) one artist is likely to contribute to many albums ii) one album is likely to have many artists on it iii) in neither case do you know how many b) Given your answer to (a), supply an SQL statement that would list the artists appearing on the album (or albums!) named Fare Thee Well Love. c) Given your answer to (a), supply an SQL statement that would list the Album Title of the albums to which an artist named Jimmy Rankin has contributed. Submission Instructions For electronic submission, a folder named yhc_assign8 containing: Your formatted Word document with answers to Question 1 named yhc_sql_q1.doc or yhc1_yhc2_sql_q1.doc (if you had a partner). Your formatted Word document with answers to Question 2 named yhc_sql_q2.doc. Printout of yhc_sql_q1.doc (or yhc1_yhc2_q1.doc) and yhc_q2.doc with your name(s) and handin code(s) in the first page header. Albums Album ID Album Title Recording Group Medium Category Price Purchase Date Year Recorded Recording Label Artists Artist ID First Name Last Name Gender Birth Date Comments CS 200 SQL Page 3

The Watcom University Database Sample.db For each database table we show first the names of the fields in that table, and below them examples of the data values that may appear in each. The names of the fields comprising the primary key are shown in bold. Underlined fields are (or are part of) a foreign key; different kinds of underlining mark distinct foreign keys. (However, limitations in Microsoft Word make it impossible to so mark fields that are part of more than one foreign key, so we also describe all foreign keys textually.) Perhaps the simplest part of the database consists of the two tables that record the people involved: students and instructions. Student Employee SurName Initials Address Birthdate Sex 86036 'COUTTS' 'S.E.' '289 Maple Drive...' 8 May 1966 'M ' EmpNum EmpName Initials Address RoomNum 81494 'DIXON' 'S.R.' '91 Trailwood Drive...' 1180 Some fields are omitted to save space. Employee numbers and student numbers look the same. This is not a problem for the database system, but it is potentially confusing for people using the database. What rooms are available, both for employee offices and for the lectures/labs? Room RoomNum Type Capacity 'LR#1' 'LECT' 40 There are three kinds of rooms: lecture rooms ( LR#1 and LR#2, of type LECT ), labs ( CHLab, CSLab, and PHLab, of type LAB ), and offices (e.g. 1180, of type OFF )

The table describes what courses are available. There is a record for each offering of a course, and for each meeting of a section there is a Class record. Finally, the Lab table associates lectures with labs. Class Credit Hours Description 'ENG' 0.50 2 'Basic Report Writing (elective)' Contains the sort of information about a course that you would find in a university catalog. Both lectures (such as CS ) and labs (such as CSL ) appear in the table. The Lab table links the two (when appropriate). EmpNum 'PHYSL' 2 64050 A course of sufficient size is delivered in several sections, for each of which there is a section record; each section meets several times a week, and for each of those meetings there is a separate Class record. Day Time Hours RoomNum 'PHYS' 1 'MON' 09:00 1 'LR#1' 'PHYS' 1 'WED' 09:00 1 'LR#1' 'PHYS' 1 'FRI' 09:00 1 'LR#1' Lab Contains information about a particular meeting of a course. [, ] is a foreign key for the table. [ RoomNum ] is a foreign key for the Room table. Lab 'CS' 'CSL' Records the connection between a lecture and a lab. Both are defined in the table. There is some potential for confusion here, in that while labs are s in the sense that they appear in the table, when a lab appears in this table it should appear only as the value of the Lab field. Sample.db Page 2

Who s enrolled in what course?. Register 86075 'PHIL' 1 This table records enrollment information. Students always enroll in a particular section of a course, even if there is only one section. The primary key, however, is just (, ) because a student can t enroll in more than one section, so there can t be more than one Register record with the same student number and course code. [ ] is a foreign key for the Student table. [] is a foreign key for the table. [, ] is a foreign key for the table. Assignment Mark AssignNum Weighting Description Date Due 'ECON' 3 20.00 'Midterm' '24 Oct 1986' Contains general information about a particular assignment (or exam) in a particular course. (Information about the mark a student received on an assignment is stored in the Marks table.) [ ] is a foreign key for the table. AssignNum Mark 86005 'CALC' 5 85 Records the mark a student received for a particular assignment (or exam) in a particular course. [, ] is a foreign key for the table. [, AssignNum ] is a foreign key for the Assignment table.

Watcom's University Database Sample.db Student Employee SurName Initials Address Birthdate Sex EmpNum EmpName Initials Address HomePhone LabPay Rank RoomNum Mark Register Room AssignNum Mark EmpNum RoomNum Type Capacity Assignment Lab Class AssignNum Weighting Description Date Due Credit Hours Description Lab Day Time Hours RoomNum Fields comprising the primary key are in bold. The arrows connect foreign keys to the linked table. In these tables, fields with the same name always indicate matching foreign and primary key fields, but that is often not the case and is certainly not a requirement.