Question

Using SQL*Plus on OMEGA, access the tables you created in Project 2 and complete the following...

Using SQL*Plus on OMEGA, access the tables you created in Project 2 and complete the following SQL transactions. Log your statements and results by spooling your file (with echo on). Directions for creating and running SQL files are available in the Assignments and Exams page in Blackboard (in the Project 2 group of files). All column headings must show in their entirety. Be sure to include a cover sheet with your full name, section, and date submitted.

19. 4 points

List the disk ID, title name, rating, format description, and fee amount for all copies rented in Rental 3; sort by disk ID. Show the fee amount formatted as currency and use the following column headings: DiskID, Title, Rating, Format, Fee.

20. 3 points

List the rating, rating description, and count of titles for each rating. Hint: use a GROUP BY clause.

21. 4 points

List the rental ID, disk ID, title name, genre name, fee code, and fee amount for all titles that have a fee amount greater than the average fee for all Rentals (using the average of the fees for all RentalDetail rows, not the average of the fees in the fee code table). Sort by title name. Hint: use a nested SELECT.

22. 3 points

List the unique title ID, title name, genre name, and rating for all titles that have been rented with a fee code of ‘B’ (do not include duplicate rows). Sort by title name.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

19) SELECT disk_ID as DiskID, title_name as Title, Rating, format_des AS Format, '$' + CONVERT(varchar(12), Fee_amt, 1) AS FROM disk where rentelID=3 ORDER BY disk_ID asc;

Here we can select DISKID title, Rating,Format and Fee where rentelID is 3. It is sorted by ORDER BY clause. To format in currency we use CONVERT().

20)SELECT rating, rating_des, count(title) FROM Disk GROUP BY Rating;

It counts the title based on the rating.count() used to count titles.

21)SELECT Rentel_ID, disk_ID, title_name, genre_name, feecode,fee_amount WHERE fee_amount>(SELECT avg(fee_amount) FROM disk) Order by title_name asc;

The nested query selects the average of all the fees amount, then it assign to the outer query condition WHERE fee_amount>avg(fee-amount). Then with this condition,selects the fields and sorted on the basis of title name.

22)SELECT distinct(titleId), title_name, genre_name, rating From Disk where fee_code='B' ORDER BY title_name asc;

With the condithin fee_code='B', selects the corresponding fields and sorted on ths basis of title_name.

Note: Here, the table names and column name are not provided. It is necessary to create queries. So in my view, i just take one table Disk with so many fields. May be these fields are not correct in your table. It make changes in your query..

Add a comment
Know the answer?
Add Answer to:
Using SQL*Plus on OMEGA, access the tables you created in Project 2 and complete the following...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help with certain questions. Please. 18. 4 points For each Rental, list the Rental...

    I need help with certain questions. Please. 18. 4 points For each Rental, list the Rental ID, Rental date, customer ID, customer first name, customer last name, and count of disks rented; sort by Rental ID. Show the Rental date formatted as ‘mm-dd-yyyy.’ Hint: use a GROUP BY clause. 19. 4 points List the disk ID, title name, rating, format description, and fee amount for all copies rented in Rental 3; sort by disk ID. Show the fee amount formatted...

  • SQL Queries – in this assignment you will be asked to create several SQL queries relating...

    SQL Queries – in this assignment you will be asked to create several SQL queries relating to the Sakila database that we installed in class. You may freely use DBeaver to create these queries, but I will expect your solution to show me the SQL code to answer or complete the tasks below. Write a query that produces the last name, first name, address, district, and phone number for every customer in the customer table. (You don’t need to include...

  • Write the following SQL statements in Microsoft Access by using the Books database from Week 2...

    Write the following SQL statements in Microsoft Access by using the Books database from Week 2 Assignment 2. Once complete, copy and paste the SQL statements in a Microsoft Word document: Write SQL statements: To update the publisher name from READ WITH US to READ FOR US To verify the updated name field for the publisher with ID 6 To make the following updates to the Publisher table (be careful with WHERE): Make Contact="John Travolta" for publisher with ID number...

  • EliteVideo is a startup company providing concierge DVD kiosk service in upscale neighborhoods. E...

    EliteVideo is a startup company providing concierge DVD kiosk service in upscale neighborhoods. Each store can own several copies (VIDEO) of each movie (MOVIE). For example, the store may have ten copies of the movie Titanic. In this case, Titanic would be an instance in the MOVIE table, while each rentable copy would be an instance in the VIDEO table. A rental transaction (RENTAL) involves one or more VIDEOs being rented to a member (MEMBERSHIP). A video can be rented...

  • May I ask the SQL code as follows? The relational database moviedb has the following database...

    May I ask the SQL code as follows? The relational database moviedb has the following database schema: Movie(title, production year, country, run time, major genre) primary key : {title, production year} Person(id, first name, last name, year born) primary key : {id} Award(award name, institution, country) primary key : {award name} Restriction Category(description, country) primary key : {description, country} Director(id, title, production year) primary key : {title, production year} foreign keys : [title, production year] ⊆ Movie[title, production year] [id]...

  • Please write ONE SQL statement for each of the following tasks using the below tables. Note...

    Please write ONE SQL statement for each of the following tasks using the below tables. Note that you can only use conditions specified in the task description and cannot manually look up data and add conditions. Task 1: return title of textbooks with price over $100. Task 2: return number of courses sections scheduled for each year and semester. Please return year, semester, and number of courses. Task 3: Return names of all courses in Information Systems undergraduate program. Task...

  • Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587...

    Prepare and execute each of the queries listed using the "Adventureworks2012" database in SQL: Server: http://msftdbprodsamples.codeplex.com/releases/view/93587 When all of your queries are complete, cut and paste the SQL Syntax into a word document. In order to see what the column names are, you need to click on the table and then Columns to see the field names. Make sure to include column headings that make sense in the queries (use the as “Field Name” after the field selected). Multi-table Queries...

  • This assignment consists of a series of SQL questions. For each question, you will need to...

    This assignment consists of a series of SQL questions. For each question, you will need to include: • SQL query. • An explanation of the query. Please include explanations as a comment AFTER your query, e.g., enclosed within a /* comments block */ ). See the first example in the SQL tutorial for a comment. You don’t need to explain straightforward code in comments. Only the parts that are interesting or different, so that we understand what you did. Question-1...

  • Create the following SQL Server queries that access the Northwind database Same as problem 3 but,...

    Create the following SQL Server queries that access the Northwind database Same as problem 3 but, limit the list to all customers who placed 3 or more orders. The product id, product name, last date that the product was ordered for all items in the Grains/Cereals category. (Hint: Use MAX) The product ID, product name, and number of distinct customers who ordered that product in 1996 Thank you. Categories Customers Employees Order Details Orders Products Shippers 9 CategoryID CategoryName Description...

  • Question 1.Write a SQL statement for each of the following questions based on the above tables...

    Question 1.Write a SQL statement for each of the following questions based on the above tables (50 Points). 1) Create “Enrollment” table. 2) Change the credits of “Database” course from 2 to 3. 3) List the course titles (not Course_No) and grades John Doe had taken. 4) Calculate average of Café Balance, and name new field as Average Balance. 5) Create a roster for “Database” course (list student ID, last name, first name, major, and status for each student enrolled...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT