Solution to B561 Assignment 4

Similar documents
Solution to the Assignment 2

CAMAvision v18.5.x System Specification Guide 7/23/2014

>

Relational Algebra. Module 3, Lecture 1. Database Management Systems, R. Ramakrishnan 1

INSIDE. Preventing Data Loss. > Disaster Recovery Types and Categories. > Disaster Recovery Site Types. > Disaster Recovery Procedure Lists


Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification

Chapter 7 Event Log. Click the [Alarm (Event Log)] icon, and [Event Log] dialog appears as below:

When a variable is assigned as a Process Initialization variable its value is provided at the beginning of the process.

Boats bid bname color 101 Interlake blue 102 Interlake red 103 Clipper green 104 Marine red. Figure 1: Instances of Sailors, Boats and Reserves

11. RESOURCE REQUIREMENT FOR COMPUTER ENGINEERING AND INFORMATION TECHNOLOGY DEPARTMENT

Using Multiple Operations. Implementing Table Operations Using Structured Query Language (SQL)

QHR Accuro EMR IT Hardware Requirements

Relational Algebra and SQL

Published. Technical Bulletin: Use and Configuration of Quanterix Database Backup Scripts 1. PURPOSE 2. REFERENCES 3.

Introduction to Microsoft Jet SQL

Technology Partners. Acceleratio Ltd. is a software development company based in Zagreb, Croatia, founded in 2009.

Computer, Phone, and Network Guidelines at Lipscomb University. Mike Green, VP and CIO Lipscomb University

Hardware and Software Requirements for Sage 50 v15 to v22

Documentum Business Process Analyzer and Business Activity Monitor Installation Guide for JBoss

PVTC Technical Requirements

The computer's internal components

SQL Simple Queries. Chapter 3.1 V3.0. Napier University Dr Gordon Russell

SMALL BUSINESS OUTSOURCING

The process of database development. Logical model: relational DBMS. Relation

FLEETMATE. Fleet Maintenance Software. Per User License. Office License. The Better Way to Manage Maintenance. Fleet Maintenance Management Software

Absolute Value Equations and Inequalities

Before deploying SiteAudit it is recommended to review the information below. This will ensure efficient installation and operation of SiteAudit.

Table of Contents. 2 Getting Started Guide

Setting up a networked printer on a local PC

HARDWARE AND SOFTWARE REQUIREMENTS

LABSHEET 1: creating a table, primary keys and data types

4. SQL. Contents. Example Database. CUSTOMERS(FName, LName, CAddress, Account) PRODUCTS(Prodname, Category) SUPPLIERS(SName, SAddress, Chain)

Hypothesis Testing. Hypothesis Testing

Proposed solutions Project Assignment #1 (SQL)

Relational Databases

How to Install and Set Up the FASTER Dashboard

HC Emission Protected Security Workstation

FedEx Ship Manager Software. New Features Guide. Version 2800

APPENDIX C. I. IT Standards and Levels of Support Service Provided by ITS. and ITS Performance Pledges

INSTALLATION AND UPGRADE

SQL: QUERIES, CONSTRAINTS, TRIGGERS

USING MANAGED PRINTER LISTS

The University of British Columbia

SOHO - Small Office/Home Office Profile Report

In this Lecture SQL SELECT. Example Tables. SQL SELECT Overview. WHERE Clauses. DISTINCT and ALL SQL SELECT. For more information

Major upgrade versions. To see which features each version of Windows 7 has, go to Microsoft's Compare Windows page.

Item Minimum Required Recommended Notes

Be sure to connect the USB cable from TonePort into your computer s USB port, and then proceed with the following steps

ADAM 5.5. System Requirements

TOP VARs Printers Servers Desktops Storage Security Mobility Software Telco

MICROSOFT WORD TUTORIAL

Scaling Out With Apache Spark. DTL Meeting Slides based on

Oracle SQL. Course Summary. Duration. Objectives

MedInformatix System Requirements

Relational Algebra. Basic Operations Algebra of Bags

ADMINISTRATORS GUIDE EPISUITE 6

Simnet Registry Repair User Guide. Edition 1.3

Introduction to IR Systems: Supporting Boolean Text Search. Information Retrieval. IR vs. DBMS. Chapter 27, Part A

Remote Access Details

Point & PointCentral 9.1

Installation Guide. Your FedEx Ship Manager system number. Before you start

SafePeak Case Study: Large Microsoft SharePoint with SafePeak

xmlns:emcs=" xmlns:tms="

Computer Hardware-Software Inventory Listing 2012

Advanced SQL - Subqueries and Complex Joins

Requirements Document for ROI Print Assessment/Print Manager

Guidelines for using Microsoft System Center Virtual Machine Manager with HP StorageWorks Storage Mirroring

ASHTON-TATE SHIPS dbase IV VERSION 1.1. announced that it shipped version 1.1 of its flagship product,

Mathematics Spring 2015 Dr. Alexandra Shlapentokh Guide #3

Definition 8.1 Two inequalities are equivalent if they have the same solution set. Add or Subtract the same value on both sides of the inequality.

Multi-dimensional index structures Part I: motivation

Software Installation Instructions IK 5000 QUADRA-CHEK. Software Version 3.0.x

F ALL Computer Purchase Guide

Read Me UNISTREAM AUTOMATION IDE

Desktop Publishing 5N0785 Learning Outcome 2 Monaghan Institute Level 5 Module

R11.2 SecureAssess Local Installation Guide. October 2014

Chapter 9 Joining Data from Multiple Tables. Oracle 10g: SQL

Preparing a SQL Server for EmpowerID installation

Relational Algebra 2. Chapter 5.2 V3.0. Napier University Dr Gordon Russell

Storage node capacity in RAID0 is equal to the sum total capacity of all disks in the storage node.

CS 564: DATABASE MANAGEMENT SYSTEMS

MN POS TM. Hardware & Peripherals. All required hardware may be purchased from Home Office.

KIP AutoCAD Installation and User Guide. KIP AutoCAD Installation and User Guide

CIS 631 Database Management Systems Sample Final Exam

Click to Continue 9/3/2013

Upgrading to Windows 8.1 A Guide for Windows 7 Users Version 1.2

HSP Update Tool V

COMMUNICATION SERVER 1000 COMMUNICATION SERVER 1000 TELEPHONY MANAGER

Hardware and system requirements ADULO GS

USB 3.0 to HDMI External Multi Monitor Graphics Adapter with 3-Port USB Hub HDMI and USB 3.0 Mini Dock 1920x1200 / 1080p

Assignment 3: SQL Queries. Questions 1. The following relations keep track of airline flight information:

AuditMatic Enterprise Edition Installation Specifications

LiveDDM hardware requirements and recommendations

Transcription:

Solution to B561 Assignment 4 Dirk Van Gucht & Mo Zhou October 17, 2008 SQL - We write r(abc for a relational schema with relation name r and attributes (or fields A, B, and C. The underlined attribute is the primary key. Given following relational schema, write SQL queries to answer the following queries. Relational schema of question 1. Product(model, maker, type PC(model, speed, ram, hd, price Laptop(model, speed, ram, hd, screen, price Printer(model, color, type, price 1

The sample data for relations of question 1. These data are not used to calculate results of following questions. Product: model maker type 1001 A PC 3001 B Printer 2001 C laptop PC: model speed ram hd price 1001 2.66 1024 250 2114 1002 1.42 512 250 955 1003 3.20 2048 160 1049 Laptop: model speed ram hd screen price 2001 2.00 1024 250 15 2114 2002 1.73 512 80 24 955 2003 1.83 2048 60 20 1049 Printer: model color type price 3001 true ink-jet 99 3002 false laser 239 3003 true laser 899 2

1. What PC models have a speed of at least 3.00? select model where PC.speed >= 3.00 2. Find the model numbers of all color laser printers. select model from Printer where type= lazer and color= true 3. Which manufacturers make laptops with a hard disk of at least 100GB? from Product P, Laptop L where P.model = L.model and L.hd >= 100 4. Find the model number and price of all products (of any type made by manufacturer B. select PC.model, PC.price from Product P, PC where P.maker= B and P.model = PC.model union select L.model, L.price from Product P, Laptop L where P.maker= B and P.model = L.model union select PR.model, PR.price from Product P, Printer PR where P.maker= B and P.model = PR.model 5. Find those manufacturers that sell Laptops, but not PC s. select DISTINCT maker from product P where P.type= Laptop select DISTINCT maker from product P where P.type= PC 6. Find those manufacturers that sell all models of PCs and lazer Printers. 3

from product P where not exists(( select PC.model (select P1.model from Product P1 where P1.maker=P.maker and P1.type= PC INTERSECT from product P where not exists(( select Pr.model from Printer Pr (select P2.model from Product P2, Printer Pr where Pr.model = P2.model and P2.maker=P.maker and Pr.type= lazer 7. Find those manufacturers whose laptops have all ram sizes that manufacturer B s laptops have. from Product P where not exists( (select Lp.ram from Laptop Lp, Product P1 where Lp.model = P1.model and P1.maker = B (select Lp1.ram from Laptop Lp1, Product P2 where Lp1.model = P2.model and P2.maker=P.maker 8. Find those manufacturers of at least two different computers (PC s or laptops with speeds of at least 2.80. from Product P, Product P1, where P.maker = P1.maker and P.model in (select PC.model where PC.speed > 2.80 4

select LP.model from Laptop LP where Lp.speed > 2.80 and P1.model in (select PC.model where PC.speed > 2.80 select LP.model from Laptop LP where Lp.speed > 2.80 and P.model <> P1.model 9. Find the manufacturers of PC s with at least two different speeds. from Product P, Product P1 where P.maker=P1.maker and exists( select PC.model, PC PC1 where PC.model <>PC1.model and PC.speed <> PC1.speed and PC.model = P.model and PC1.model = P1.model 10. Find the manufacturers who sell exactly two different models of PC. from Product P, Product P1 where P.maker=P1.maker and exists ( select PC1.model PC1, PC PC2 where PC1.model <> PC2.model and PC1.model=P.model and PC2.model=P1.model from Product P, Product P1, Product P2 where P.maker=P1.maker and P1.maker=P2.maker 5

exists ( select PC1.model PC1, PC PC2, PC PC3 where PC1.model <> PC2.model and PC1.model<>PC3.model and PC2.model<>PC3.model and PC1.model=P.model and PC2.model=P1.model and PC3.model=P2.model 11. Find those pairs of PC models that have both the same speed and RAM. A pair should be listed only once; e.g., list (i, j but not (j, i. Hint: The model numbers can be compared. select P1.model, P2.model P1, PC P2 where P1.model < P2.model and P1.speed = P2.speed and P1.ram = P2.ram 12. Find the manufacturer(s of the computer (PC or laptop with the highest available speed. Hint: the highest speed means that it is not smaller than any other speeds. If you can find all the speeds which are smaller than some speed, you can solve this problem. from Product P where P.model in ( select Computer.model from (select PC.model, PC.speed select LP.model, LP.speed from Laptop LP AS Computer where Computer.speed = ( select MAX(Computer1.speed from (SELECT PC1.model, PC1.speed FROM PC PC1 SELECT Lp1.model, Lp1.speed 6

FROM Laptop Lp1 AS Computer1 7