Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask DBMS Expert


Home >> DBMS

PART MARKING: For this section, we will use part marking. This means we will supply model answers to all questions but we will only mark six questions. We will choose these randomly and each question chosen for marking will be worth three marks. If you do not answer a question that is chosen for marking, you will receive no marks. You should therefore attempt all the questions. These questions are designed to hone your SQL skills before the exam.

Use the relations below to write SQL queries to solve the business problems specified.

CLIENT(clientno#,name, client_referred_by#)
ORDER(orderno#, clientno#, order_date, empid#)
ORDER_LINE(orderno#, order line number#, item_number#, no_of_items, item_ cost, shipping_date)
ITEM(item_number#, item_type, cost)
EMPLOYEE(empid#, emp_type#, deptno, salary, firstname, lastname)


Notes:

1. Each client may be referred by another client. If so, the client number of the referring client is stored in referred_by.

2. The total cost for a particular order line = no_of_items X item_cost.

1. Display all the rows and columns in the CLIENT table. Sort by client name in reverse alphabetical order.

2. Display the item number and total cost for each order line (total cost = no of items X item cost). Name the calculated column TOTAL COST.

3. Display all the client numbers in the ORDER table. Remove duplicates.

4. Display the order number and client number from the ORDER table. Output the result in the format. Client ordered

5. Display full details from the ORDER_LINE table where the item number is (first condition) between 1 and 200 (no > or < operators) OR the item number is greater than 1000 AND (second condition) the item cost is not in the list 1000, 2000, 3000 OR the order number is not equal to 1000.

6. Display the client name and order date for all orders using the traditional method.

7. Repeat query (7) but also display all clients who have never ordered anything.

8. Display the client name and order date for all orders using the natural join keywords.

9. Display the client name and order date for all orders using the JOIN . . . USING method.

10. Display the client number, order date and shipping date for all orders where the shipping date is between three and six months after the order date.

11. Display the client number and name and the client number and name of the person who referred that client.

12. Display the client name in upper case only and in lower case only.

13. Display the second to fifth characters in each client name.

14. Display the item_cost and then round it to the nearest hundred, ten, unit, tenth and hundredth.

15. Display the item_cost and then truncate it to the nearest hundred, ten, unit, tenth and hundredth.

16. Display the order number, order line number and the shipping date. If the shipping date is null, display the string .

17. Display the order number and average item cost for each order.

18. Display the clientno and total value for all orders placed by that client. Output the result in the following format: Client has placed orders to the value of

19. Display all clients whose name begins with the letter J or contains the letter M anywhere or contains E as the third letter.

20. Using a set operator, display the client number of all clients who have never placed an order.

21. Using a set operator, display the client number of all clients who have ever placed an order and whose name does not contain the string Sm.

22. Display the order number, number of lines in the order, total number of items and total value for all orders that have a total value greater than $100

23. Display the client name for all clients who have placed an order where any order line has more than 3 items. Do not use a table join anywhere in your query.

24. Display the order number for all orders whose average item cost is greater than the overall average item cost across all orders.

25. Display the client number and the value of the highest value order placed by that client. (High challenge question - well above exam standard).

26. Display the earliest shipping date in the format: DD/MON/YYYY

27. Display the order number and the number of months since the order was shipped for all orders that have been shipped in the last year (365 days). (Hint: Unshipped orders will have a null value).

28. Display the item_number, the total number of times that item has been sold and the average cost for that item. Restrict that output to items that have been included in more than 500 orders. (Hint: Assume an item will appear in only one order line of an order).

29. Display the surname for all employees who earn less the average salary of all those employees in the department with the lowest average salary.

30. Display the client number and the total number of orders the client has placed for all clients who have placed at least one order in 2011. (Hint: Use exists).

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M9525602

Have any Question?


Related Questions in DBMS

Sql assignmentin these exercises youll enter and run your

SQL Assignment In these exercises, you'll enter and run your own SELECT statements. You will use the MyGuitarShop database for these queries. If you do not already have the MyGuitarShop database, the SQL script and the i ...

Sqlquery 1 how many products have standard price less than

SQL Query 1. How many products have standard price less than 1000? Query 2: Display all attributes for products made of "Cherry" from Product table w/o referring to column names. Query 3: Display all product names having ...

You are responsible for keeping track of meal expenses for

You are responsible for keeping track of meal expenses for ten employees while at a business lunch to which your employer has invited you to attend. Write an algorithm that inputs the lunch costs for each the ten employe ...

Stored procedure please create the following stored

Stored procedure. Please create the following stored routines using CPS3740_2017S database using the tables in dreamhome database. xxxx is your email id 1) Implement a stored procedure p3Q21_xxxx to display the Branch ci ...

Question create the physical data model for the logical

Question: Create the physical data model for the logical data model that you submitted in IP3. This should include all of the data definition language SQL. Your submission should include all DDL needed to: Create the tab ...

Question as explained throughout this course entity

Question: As explained throughout this course, entity relationship modeling is a critical element of database design. If the database is not properly modeled, it is unlikely that the database will be properly developed. ...

Question 1 unified communications system eg email

Question: 1. Unified Communications System (e.g., email, conferencing, and messaging) - The local area network is slower than needed, especially for newer, cloud-based applications. The email system needs refurbishment a ...

Real time analytics - data analytics assignment -this is a

Real Time Analytics - Data Analytics Assignment - This is a business analytics project aimed at generating innovative analytics solutions for a Global Food Consulting firm working in the area of Animal agriculture and fa ...

Your taskyou have been commissioned to develop a database

Your task You have been commissioned to develop a database system that is capable of keeping records for FU's table tennis matches from now on. The database needs to keep a record of: - All team information, including pl ...

Sqlwrite a select statement that returns one column from

SQL Write a SELECT statement that returns one column from the Vendor table named Full Name. Create this column from the VendorContactFName and VendorContactLName columns. Format it as follows: last name, comma, first nam ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As