Download presentation
Presentation is loading. Please wait.
1
Test 1 Review
2
What’s wrong with this table? ItemNoType InitialCost RepairNo Date RepairCost 100Drill Press35002000 5/5/06 375 200Lathe 47502100 5/7/06 255 100Drill Press35002200 5/19/06 178 300Mill 273002300 5/11/06 1785 100Drill Press35002400 5/11/06 0 100Drill Press35002200 6/1/06 275
3
COLLEGE(lastName, stuID, homeAddr, homePhone, dormRoom, Roommate, dormAddr, status, mealPlan, roomCharge, mealPlanCharge) Dependencies: stuID all but roommate stuID roommate mealPlan mealPlanCharge dormRoom dormAddr, roomCharge dormAddr roomCharge 1NF 2NF 3NF
4
CAREER_CENTER(StuName, StuID, StuEmail, Major, CounselorID, CounselorEmail, CompanyID, CompanyName, CompanyAddress, Contact, StartDate, EndDate, Grade, PayRate) A student may have had many internships, but may have at most one internship with a particular company. A student provides exactly one email address; students may register only one major with the career center. Each company is expected to hire several student interns; each company has one contact person. Each internship assignment has a start date, an end date and a rate of pay. Internship assignments are graded. Each career center counselor is assigned to oversee all students in particular majors; (e.g., Mary Smith counsels all interns with cs and business majors; Joe Evans counsels all interns with English and Spanish majors, etc)
5
Rep (repNum, repName, repZip, commission) Customer (custNum, custName, custZip, balance, repNum) Orders (orderNum, orderDate, custNum) Draw the relational schema
6
Display all information about customers who have non-zero balances. Rep (repNum, repName, repZip, commission) Customer (custNum, custName, custZip, balance, repNum) Orders (orderNum, orderDate, custNum)
7
Display the names of all customers, along with their balances, in ascending order. Rep (repNum, repName, repZip, commission) Customer (custNum, custName, custZip, balance, repNum) Orders (orderNum, orderDate, custNum)
8
Display the name of each customer whose rep is “Jones”. Rep (repNum, repName, repZip, commission) Customer (custNum, custName, custZip, balance, repNum) Orders (orderNum, orderDate, custNum)
9
Display the name of each customer along with the name of his/her rep. Rep (repNum, repName, repZip, commission) Customer (custNum, custName, custZip, balance, repNum) Orders (orderNum, orderDate, custNum)
10
Display the numbers of all customers who have never placed an order. Rep (repNum, repName, repZip, commission) Customer (custNum, custName, custZip, balance, repNum) Orders (orderNum, orderDate, custNum)
11
Display the names of all customers who have never placed an order. Rep (repNum, repName, repZip, commission) Customer (custNum, custName, custZip, balance, repNum) Orders (orderNum, orderDate, custNum)
12
Display each rep number with the number of customers that rep has. Rep (repNum, repName, repZip, commission) Customer (custNum, custName, custZip, balance, repNum) Orders (orderNum, orderDate, custNum)
13
Display the names of all customers and the number of orders they have made. Rep (repNum, repName, repZip, commission) Customer (custNum, custName, custZip, balance, repNum) Orders (orderNum, orderDate, custNum)
14
Display the names of all customers who have made 3 or more orders. Rep (repNum, repName, repZip, commission) Customer (custNum, custName, custZip, balance, repNum) Orders (orderNum, orderDate, custNum)
15
Using SQL to verify referential integrity Prob 4.4 – do these tables uphold referential integrity? DEPT (DeptName, BudgetCode) EMPLOYEE (EmpNum, Name, Email, DeptName)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.