Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Questions on Database with Solutions - Spring 2007 | CSCI 2910, Quizzes of Computer Science

Material Type: Quiz; Professor: Tarnoff; Class: Server Side Web Prog; Subject: Computer & Information Science (CSCI); University: East Tennessee State University; Term: Spring 2007;

Typology: Quizzes

Pre 2010

Uploaded on 08/17/2009

koofers-user-w31
koofers-user-w31 🇺🇸

5

(1)

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Questions on Database with Solutions - Spring 2007 | CSCI 2910 and more Quizzes Computer Science in PDF only on Docsity! CSCI 2910 Database Intro Quiz – Spring 2007 Name: ________________________________ Driver Table license_no first_name last_name Birthday gender 85AB8354 Mickey Mouse November 18, 1928 M 44CD6376 Minnie Mouse November 18, 1928 F 86TE4976 Donald Duck June 9, 1934 M 34PL3244 Daisy Duck April 5, 1937 F Vehicle Table vin year make model color primary_driver 1D3483488593 2007 Chevrolet Corvette Red 44CD6376 3744733845 1974 Chevrolet Nova Gold 85AB8354 1F8574465787 2005 Ford F-350 Black 86TE4976 2C4934185737 2001 Nissan Sentra White 34PL3244 1E8477365273 1997 Dodge Neon Brown 85AB8354 1. Which of the fields of the Driver Table should be used as its primary key? Remember that a primary key needs to be unique for each record. In the case of the drivers in the driver table, the unique id is the field license_no. 2. Which of the fields of the Vehicle Table should be used as its primary key? vin 3. Which car(s) is Daisy Duck the primary driver for? We can determine Daisy Duck's car(s) by using the common key, i.e., the records where Daisy's license_no matches the primary_driver number identifies her car(s). This is true for exactly one car, the 2001 white Nissan Sentra. 4. What SQL data type would best represent the license_no field, a field of exactly 8 characters? a.) BIT b.) INTEGER c.) BIGINT d.) FLOAT e.) DATE f.) DATETIME g.) YEAR h.) CHAR i.) VARCHAR j.) TEXT k.) ENUM There are two ways to define license_no depending on whether you assumed it was to be an integer or a string, i.e., would letters be allowed. If you assumed it would be restricted to integer values, you could have selected the INTEGER[8] type. (TINYINT[M], SMALLINT[M], and MEDIUMINT[M] would be too small to handle 8 digits.) The other option, if you assumed letters could be part of the license_no field, would be to declare it as a CHAR[8]. VARCHAR[8] is not as good as CHAR[8] since the field is intended to be exactly 8 characters. CHAR[8] would make it so you wouldn't have a question as to whether 00001234 was equal to 1234. 5. What SQL data type would best represent the first_name field, a field of up to 20 characters? a.) BIT b.) INTEGER c.) BIGINT d.) FLOAT e.) DATE f.) DATETIME g.) YEAR h.) CHAR i.) VARCHAR j.) TEXT k.) ENUM Two things are important when defining the data type for first_name: it uses characters and it can be up to 20 characters in length. That means VARCHAR[20] would be the best type. 6. What SQL data type would best represent the birthday field? a.) BIT b.) INTEGER c.) BIGINT d.) FLOAT e.) DATE f.) DATETIME g.) YEAR h.) CHAR i.) VARCHAR j.) TEXT k.) ENUM Okay, hopefully this was a no-brainer. A birthday is a date, right? common key
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved