subject

This problem has been solved!
See the answer
Please submit SQL statements as a plain text file (.txt). If blackboard rejects txt file you can submit a zipped file containing the text file. Word, PDF, or Image format are not accepted. You do not need to show screen shot. Make sure you have tested your SQL statements in Oracle 11g.

Assumptions:
Each tool belongs to a category.
Each category may have a parent category but the parent category should not have parent category (so at most two levels). E. g., a Tool A belongs to electric mower, and electric mower belongs to mower. Mower has no parent category.
Each tool can be rented at different time units. The typical time units are hourly, daily, and weekly. There is a different price for each time unit and tool combination. E. g., tool A may be rented at $5 per hour, $30 per day, and $120 per week.
Each customer can rent a tool for a certain number of time units. If the tool is returned late a late fee will be charged.

The list of tables is:

Tables:
Cust Table:
cid, -- customer id
cname, --- customer name
cphone, --- customer phone
cemail, --- customer email
Category table:
ctid, --- category id
ctname, --- category name
parent, --- parent category id since category has a hierarchy structure, power washers, electric power washers, gas power washers. You can assume that there are only two levels.
Tool:
tid, --- tool id
tname, --- tool name
ctid, --- category id, the bottom level.
quantity, --- number of this tools
Time_unit table allowed renting unit
tuid, --- time unit id
len, --- length of period, can be 1 hour, 1 day, etc.
min_len, --- minimal #of time unit, e. g., hourly rental but minimal 4 hours.
Tool_Price:
tid, --- tool id
tuid, --- time unit id
price, -- price per period
Rental:
rid, --- rental id
cid, --- customer id
tid, --- tool id
tuid, --- time unit id
num_unit, --- number of time unit of rental, e. g., if num_unit = 5 and unit is hourly, it means 5 hours.
start_time, -- rental start time
end_time, --- suppose rental end_time
return_time, --- time to return the tool
credit_card, --- credit card number
total, --- total charge
Problem 1. Please write ONE SQL statement for each of the following tasks using tables above. You can ONLY use conditions listed in the task description. Task 1 and 2 each has 5 points. Tasks 3 to 6 each has 10 points. [50 points]
Task 1: return IDs of rentals started in August 2019.
Hint: function trunc(x) converts x which is of timestamp type into date type.
Task 2: Return names and quantity of all tools under the category carpet cleaner. You can assume there is no subcategory under carpet cleaner
Task 3: return number of rentals per customer along with customer ID in the year 2019 (i. e., the start_time of the rental is in 2019).
Task 4: return IDs of tools that has been rented at least twice in 2019.
Task 5: return the price of renting a small carpet cleaner (the name of the tool) for 5 hours.
Hint: find unit price for hourly rental and then multiply that by 5.
Task 6: return names of customers who have rented at least twice in year 2019 (i. e., rental’s start time is in 2019).

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
Jackson is teaching the decimal number system. he wants his students to know how to expand numbers by powers of 10. which is the correct order in which digits are assigned values in the decimal number system?
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
question
Computers and Technology, 24.06.2019 00:30
Afiling system in which an intermediary source of reference, such as a file card, must be consulted to locate specific files is called a(n) system. a. shelf filing b. direct filing c. indirect filing d. shingling
Answers: 1
question
Computers and Technology, 25.06.2019 04:00
Plz there is a problem with my account. i no longer have ! ( hand,ambitious,virtuoso etc.) it's like getting brainliest means nothing. how do i get ranks back?
Answers: 1
You know the right answer?
This problem has been solved!
See the answer
Please submit SQL statements as a plain tex...
Questions
question
Mathematics, 08.11.2019 00:31
question
Mathematics, 08.11.2019 00:31