Search results for 'Chapter 5 from Chapter 4 Babbage CPA'
-
DAT/380 Week 3 LAB 3.16 - Select horses with logical operators
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 3 LAB 3.16 - Select horses with logical operators
The Horse table has the following columns:
ID - integer, primary key
RegisteredName - variable-length string
Breed - variable-length string
Height - decimal number
BirthDate - dateWrite a SELECT statement to select the registered name, height, and birth date for only horses that have a height between 15.0 and 16.0 (inclusive) or have a birth date on or after January 1, 2020.
Learn More -
DAT/380 Week 3 LAB 3.15 - Delete rows from Horse table
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 3 LAB 3.15 - Delete rows from Horse table
The Horse table has the following columns:
ID - integer, auto increment, primary key
RegisteredName - variable-length string
Breed - variable-length string
Height - decimal number
BirthDate - dateDelete the following rows:
Learn More
Horse with ID 5.
All horses with breed Holsteiner or Paint.
All horses born before March 13, 2013. -
DAT/380 Week 3 LAB 3.14 - Update rows in Horse table
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 3 LAB 3.14 - Update rows in Horse table
The Horse table has the following columns:
ID - integer, auto increment, primary key
RegisteredName - variable-length string
Breed - variable-length string, must be one of the following: Egyptian Arab, Holsteiner, Quarter Horse, Paint, Saddlebred
Height - decimal number, must be ≥ 10.0 and ≤ 20.0
BirthDate - date, must be ≥ Jan 1, 2015
Make the following updates:Change the height to 15.6 for horse with ID 2.
Learn More
Change the registered name to Lady Luck and birth date to May 1, 2015 for horse with ID 4.
Change every horse breed to NULL for horses born on or after December 22, 2016. -
DAT/380 Week 3 LAB 3.13 - Insert rows into Horse table
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 3 LAB 3.13 - Insert rows into Horse table
The Horse table has the following columns:
ID - integer, auto increment, primary key
RegisteredName - variable-length string
Breed - variable-length string, must be one of the following: Egyptian Arab, Holsteiner, Quarter Horse, Paint, Saddlebred
Height - decimal number, must be between 10.0 and 20.0
BirthDate - date, must be on or after Jan 1, 2015Insert the following data into the Horse table:
Learn More
RegisteredName Breed Height BirthDate
Babe Quarter Horse 15.3 2015-02-10
Independence Holsteiner 16.0 2017-03-13
Ellie Saddlebred 15.0 2016-12-22
NULL Egyptian Arab 14.9 2019-10-12 -
DAT/380 Week 3 LAB 3.12 - Create LessonSchedule table with FK constraints
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 3 LAB 3.12 - Create LessonSchedule table with FK constraints
Two tables are created:
Horse with columns:
ID - integer, primary key
RegisteredName - variable-length stringStudent with columns:
ID - integer, primary key
FirstName - variable-length string
LastName - variable-length stringCreate the LessonSchedule table with columns:
HorseID - integer with range 0 to 65 thousand, not NULL, partial primary key, foreign key references Horse(ID)
StudentID - integer with range 0 to 65 thousand, foreign key references Student(ID)
LessonDateTime - date/time, not NULL, partial primary keyIf a row is deleted from Horse, the rows with the same horse ID should be deleted from LessonSchedule automatically.
If a row is deleted from Student, the same student IDs should be set to NULL in LessonSchedule automatically.
Note: Table and column names are case sensitive in the auto-grader.
CREATE TABLE Horse (
ID SMALLINT UNSIGNED AUTO_INCREMENT,
RegisteredName VARCHAR(15),
PRIMARY KEY (ID)
);CREATE TABLE Student (
ID SMALLINT UNSIGNED AUTO_INCREMENT,
FirstName VARCHAR(20),
LastName VARCHAR(30),
PRIMARY KEY (ID)
);-- Your SQL statements go here
Learn More -
DAT/380 Week 3 LAB 3.11 - Create Student table with constraints
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 3 LAB 3.11 - Create Student table with constraints
Create a Student table with the following column names, data types, and constraints:
Learn More
ID - integer with range 0 to 65 thousand, auto increment, primary key
FirstName - variable-length string with max 20 chars, not NULL
LastName - variable-length string with max 30 chars, not NULL
Street - variable-length string with max 50 chars, not NULL
City - variable-length string with max 20 chars, not NULL
State - fixed-length string of 2 chars, not NULL, default "TX"
Zip - integer with range 0 to 16 million, not NULL
Phone - fixed-length string of 10 chars, not NULL
Email - variable-length string with max 30 chars, must be unique -
DAT/380 Week 3 LAB 3.10 - Create Horse table with constraints
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 3 LAB 3.10 - Create Horse table with constraints
Create a Horse table with the following columns, data types, and constraints. NULL is allowed unless 'not NULL' is explicitly stated.
ID - integer with range 0 to 65 thousand, auto increment, primary key
RegisteredName - variable-length string with max 15 chars, not NULL
Breed - variable-length string with max 20 chars, must be one of the following: Egyptian Arab, Holsteiner, Quarter Horse, Paint, Saddlebred
Height - number with 3 significant digits and 1 decimal place, must be ≥ 10.0 and ≤ 20.0
BirthDate - date, must be ≥ Jan 1, 2015Note: Not all constraints can be tested due to current limitations of MySQL.
Learn More -
DAT/380 Week 2 LAB 2.10 - Select employees and managers with inner join
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 2 LAB 2.10 - Select employees and managers with inner join
The Employee table has the following columns:
ID - integer, primary key
FirstName - variable-length string
LastName - variable-length string
ManagerID - integer
Write a SELECT statement to show a list of all employees' first names and their managers' first names. List only employees that have a manager. Order the results by Employee first name. Use aliases to give the result columns distinctly different names, like "Employee" and "Manager".Hint: Join the Employee table to itself using INNER JOIN.
Learn More -
DAT/380 Week 2 LAB 2.9 - Select movie ratings with left join
Regular Price: $5.00
Special Price $3.00
DAT/380 Week 2 LAB 2.9 - Select movie ratings with left join
The Movie table has the following columns:
ID - integer, primary key
Title - variable-length string
Genre - variable-length string
RatingCode - variable-length string
Year - integer
The Rating table has the following columns:Code - variable-length string, primary key
Description - variable-length string
Write a SELECT statement to select the Title, Year, and rating Description. Display all movies, whether or not a RatingCode is available.Hint: Perform a LEFT JOIN on the Movie and Rating tables, matching the RatingCode and Code columns.
Learn More -
PRG 211 Week 5 Labs
Regular Price: $20.00
Special Price $15.00
PRG 211 Week 5 Labs
Lab 11.1 Miles to track laps
One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input, and outputs the number of laps.
Ex: If the input is 1.5, the output is:
6.0Ex: If the input is 2.2, the output is:
8.8Your program should define and call a function:
Function MilesToLaps(float userMiles) returns float userLaps
Lab 11.2 Driving costWrite a function DrivingCost with parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type float.
Ex: If the function is called with 50 20.0 3.1599, the function returns 7.89975.
Define that function in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both floats). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your DrivingCost function three times.
Ex: If the input is 20.0 3.1599, the output is:
1.57995 7.89975 63.198Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. In the DrivingCost function, use the variables in the following order to calculate the cost: drivenMiles, milesPerGallon, dollarsPerGallon.
Lab 11.3 Step counterA pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked. If the input is 5345, the output is 2.6725.
Your program should define and call a function:
Function StepsToMiles(integer userSteps) returns float numMiles
Lab 11.4 Leap yearA year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are:
1) The year must be divisible by 4
2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400
Some example leap years are 1600, 1712, and 2016.
Write a program that takes in a year and determines whether that year is a leap year. If the input is 1712, the output is: 1712 is a leap year. If the input is 1913, the output is: 1913 is not a leap year.
Your program must define and call a function:
Function OutputLeapYear(integer inputYear) returns nothing
The function should output whether the input year is a leap year or not.
Lab 11.5 Max and min numbersWrite a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the three values. If the input is 7 15 3, the output is:
largest: 15
smallest: 3Your program should define and call two functions:
Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNum
Function SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum
The function LargestNumber should return the largest number of the three input values. The function SmallestNumber should return the smallest number of the three input values.
Lab 11.6 Output values below an amountWrite a program that first gets a list of six integers from input. The first five values are the integer list. The last value is the upper threshold. Then output all integers less than or equal to the threshold value.
Ex: If the input is 50 60 140 200 75 100, the output is:
50 60 75
For coding simplicity, follow every output value by a space, including the last one.Such functionality is common on sites like Amazon, where a user can filter results.
Your program should define and use a function:
Learn More
Function outputIntsLessThanOrEqualToThreshold(integer array(?) userVals, integer upperThreshold) returns nothing