W10_midterm_soln - CS 348 Midterm Exam No aids permitted...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 348 Midterm Exam No aids permitted Winter 2010 Professor Tompa February 25, 2010, 1:00-2:20 pm Page 1 of 4 Write all your answers neatly in the answer booklet provided. Be sure your name and id number are on the cover of the booklet. Note that in marking your answers to Questions 1 and 2, we will be tolerant of minor syntax errors for which your intention is clear. 1. [6 marks] Write an appropriate DDL statement to declare the following relation in SQL: Car ( LicenceNum : string, Province : string , Make : string, Model : string, Year : integer, VIN : string) where values of Year must lie between 1900 and 2011; Make is a foreign key into a relation called Manufacturer (having an attribute also named Make as its primary key); and VIN is required to take a unique value for each Car tuple. create table Car ( LicenceNum varchar(10) not null, Province char(2) not null, Make varchar(20) references Manufacturer, Model varchar(20), Year integer check(Year >= 1900 and Year <= 2011), VIN char(20) unique, primary key (LicenceNum, Province) ) 2. [24 marks in total] The Nutritionists Union has created the following relational database schema to maintain information about foods, including their nutritional value and health implications: Class ( food , food_group ) Requirement ( nutrient , minimum_recommendation ) Supplies ( food , nutrient , amount ) Combats ( nutrient , disease ) (The Class relation partitions foods into food groups;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/21/2010 for the course CS 348 taught by Professor Woody during the Spring '09 term at Waterloo.

Page1 / 4

W10_midterm_soln - CS 348 Midterm Exam No aids permitted...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online