Using the following variable list/data dictionary, I want youto write relational
ID: 3613669 • Letter: U
Question
Using the following variable list/data dictionary, I want youto write relationalexpressions using the variables listed:
Variable Data Type Example Identifier integer 12345 Name characters Smith, John Age integer 29 Month integer 04 Day integer 24 Year integer 2008 Number integer 3
Imagine the variable list represents movie rental customers. The “Month”, ”Day”, and“Year” variables represent the dates their movies aredue back to the rental company and the “Number”variable contains the number of movies they currently arerenting.
I only want you to write the logical expression. To giveyou a point of reference, you can imagine that your logicalexpression will be used in a selection statement to select a listof particular customers for a report. AGAIN, I don’twant you to write the report or even the “if thenelse”, write just the logical expression; do not write anyother statements. Here are the instructions for theexpressions I want you to write:
1. Over 21 years old 2. At least 45 years old 3. No more than 18 years old 4. Due no later than November 15 of any year 5. Due up to and including April 20, 2010 6. Due by February 15, 2010 7. Due as early as September 15, 2009 8. Fewer than 5 movies 9. No more than 3 movies 10. No movies
Use the variable names listed in the variable list and followthe numbered instructions above for the logic of the expression. DO NOT make up variable names; I’ve already given themto you.
HINT: When dealing with the dates, please recognize thatthe data is stored in three, separate variables. The datesare NOT stored as January 20, 2010. They are stored with 01in Month, 20 in Day, and 2010 in Year.
You also may use the logical AND and/or OR to combine phrasesin an expression.
For example, if you were asked to select all people under theage of 25 who live in the city of Elk Grove, your expression wouldlook like this:
Age < 25 AND City = “Elk Grove”
Using the following variable list/data dictionary, I want youto write relationalexpressions using the variables listed:
Variable Data Type Example Identifier integer 12345 Name characters Smith, John Age integer 29 Month integer 04 Day integer 24 Year integer 2008 Number integer 3
Imagine the variable list represents movie rental customers. The “Month”, ”Day”, and“Year” variables represent the dates their movies aredue back to the rental company and the “Number”variable contains the number of movies they currently arerenting.
I only want you to write the logical expression. To giveyou a point of reference, you can imagine that your logicalexpression will be used in a selection statement to select a listof particular customers for a report. AGAIN, I don’twant you to write the report or even the “if thenelse”, write just the logical expression; do not write anyother statements. Here are the instructions for theexpressions I want you to write:
1. Over 21 years old 2. At least 45 years old 3. No more than 18 years old 4. Due no later than November 15 of any year 5. Due up to and including April 20, 2010 6. Due by February 15, 2010 7. Due as early as September 15, 2009 8. Fewer than 5 movies 9. No more than 3 movies 10. No movies
Use the variable names listed in the variable list and followthe numbered instructions above for the logic of the expression. DO NOT make up variable names; I’ve already given themto you.
HINT: When dealing with the dates, please recognize thatthe data is stored in three, separate variables. The datesare NOT stored as January 20, 2010. They are stored with 01in Month, 20 in Day, and 2010 in Year.
You also may use the logical AND and/or OR to combine phrasesin an expression.
For example, if you were asked to select all people under theage of 25 who live in the city of Elk Grove, your expression wouldlook like this:
Age < 25 AND City = “Elk Grove”
Explanation / Answer
Variable Data Type Example Identifier integer 12345 Name characters Smith, John Age integer 29 Month integer 04 Day integer 24 Year integer 2008 Number integer 31. Over 21 yearsold Age>21
2. At least 45 yearsold Age>=45
3. No more than 18 yearsold Age<=18
4. Due no later than November 15 of anyyear (Month==11 AND Day<=15 )OR Month<11
5. Due up to and including April 20,2010 (Month==4AND DAY <=20 AND Year ==2010)OR YEAR <2010 OR(YEAR==2010 AND Month<4)
6. Due by February 15,2010 (Month==2 AND DAY <=15 AND Year==2010)OR (Month==1ANDYear==2010) OR Year<2010
7. Due as early as September 15,2009 (Month>=9AND Day>=15 AND Year==2009)OR(Month>9AND Year>=2009)
8. Fewer than 5movies Movies < 5
9. No more than 3movies Movies<=3
10. Nomovies Movies ==0
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.