Study Guides (400,000)
US (230,000)
UC-Irvine (3,000)
COMPSCI (100)
Final

COMPSCI 122A Lecture 3: Assignment 5 TemplateExam


Department
Computer Science
Course Code
COMPSCI 122A
Professor
Kenneth Shea
Study Guide
Final

This preview shows pages 1-2. to view the full 8 pages of the document.
1
Last Name: Sun First Name: Bolun Student ID: 52332355
1. [10 pts] Find the store_ids, cities, and phone numbers for all stores named ‘Jackson Food Store’.
a) [7 pts] SQL Query:
SELECT store_id, city, phone FROM cs122a_sp20.Stores WHERE name="Jackson Food Store";
b) [3 pts] Result: (2 Rows)

Only pages 1-2 are available for preview. Some parts have been intentionally blurred.

2
2. [10 pts] List the phone numbers and phone types for customers who own at least one ‘Toyota’
car.
a) [7 pts] SQL Query:
SELECT number, type FROM UserPhone WHERE user_id IN(
SELECT user_id FROM Customers WHERE user_id IN(
SELECT user_id
FROM Own
WHERE license_plate IN( SELECT license_plate FROM Vehicles WHERE make = 'Toyota' )
)
)
b) [3 pts] Result: (4 Rows)
You're Reading a Preview

Unlock to view full version

Only pages 1-2 are available for preview. Some parts have been intentionally blurred.

3
3. [10 pts] List the product ID, name, and list_price of products that are associated with one or
more orders with a total_price greater than $300.
a) [7 pts] SQL Query:
SELECT product_id, name, list_price FROM Products WHERE product_id IN(
SELECT product_id FROM OrderItems WHERE order_id IN( SELECT order_id
FROM Orders
WHERE total_price > 300));
b) [3 pts] Result: (10 Rows)
You're Reading a Preview

Unlock to view full version