Rewrite the following query so that the result set contains a single row with five columns...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Rewrite the following query so that the result set contains a single row with five columns (one for each rating). Name the five columns (G, PG, FG_13, R, and MC 17). mysql> SELECT rating COUNT(*) -> FROM film ->GROUP BY rating: It should retrieve the following: | PG PG-13 | R T 178 1 row in set (0.28 sec) 194 | 223 195 1 NC-17 210 Write a query that returns the alphabetized first letter of the customer's last name and the count of active and inactive customers. Do not limit the results to only those first letters that occur in the last name colum of the customer table but return results that include any missing letters from the data set. (HINT: You will need to fabricate a table composed of the 26 letters of the alphabet and use an outer join to resolve this problem.) Label the columns as follows: starts with is the first column and the first letter of the customer's last_name. .active_count is the second column and the count of active customers (as defined in the textbook examples of Chapter 11). inactive_count is the third column and the count of inactive customers (as defined in the textbook examples of Chapter 11). . The output should look like the following: I starts with active_count | inactive_count I 18 1 55 1 49 1 17 1 11 1 251 42 1 49 1 A 13 IC ID LE 18 10 IM 1I 13 IX 12 IM IN 10 I P 10 IR 15 10 IV IW IX IY 12 4 26 rows in set (0.00 sec) 31 13 1 13 1 21 1 57 1 201 10 1 28 1 38 1 54 1 201 01 37 1 01 31 01 01 01 21 01 01 01 01 21 11 01 01 01 21 01 0 0 01 1 0 01 Rewrite the following query so that the result set contains a single row with five columns (one for each rating). Name the five columns (G, PG, FG_13, R, and MC 17). mysql> SELECT rating COUNT(*) -> FROM film ->GROUP BY rating: It should retrieve the following: | PG PG-13 | R T 178 1 row in set (0.28 sec) 194 | 223 195 1 NC-17 210 Write a query that returns the alphabetized first letter of the customer's last name and the count of active and inactive customers. Do not limit the results to only those first letters that occur in the last name colum of the customer table but return results that include any missing letters from the data set. (HINT: You will need to fabricate a table composed of the 26 letters of the alphabet and use an outer join to resolve this problem.) Label the columns as follows: starts with is the first column and the first letter of the customer's last_name. .active_count is the second column and the count of active customers (as defined in the textbook examples of Chapter 11). inactive_count is the third column and the count of inactive customers (as defined in the textbook examples of Chapter 11). . The output should look like the following: I starts with active_count | inactive_count I 18 1 55 1 49 1 17 1 11 1 251 42 1 49 1 A 13 IC ID LE 18 10 IM 1I 13 IX 12 IM IN 10 I P 10 IR 15 10 IV IW IX IY 12 4 26 rows in set (0.00 sec) 31 13 1 13 1 21 1 57 1 201 10 1 28 1 38 1 54 1 201 01 37 1 01 31 01 01 01 21 01 01 01 01 21 11 01 01 01 21 01 0 0 01 1 0 01
Expert Answer:
Related Book For
Government and Not for Profit Accounting Concepts and Practices
ISBN: 978-1118155974
6th edition
Authors: Michael H. Granof, Saleha B. Khumawala
Posted Date:
Students also viewed these databases questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
The new line character is utilized solely as the last person in each message. On association with the server, a client can possibly (I) question the situation with a client by sending the client's...
-
Cassandra is retiring December 31, 2023, after many, happy years of employment with Canadian National Railway Company (CN). She is fortunate to be part of a Defined Benefit Pension Plan (DBPP). Her...
-
The rate of change of atmospheric pressure P with respect to the altitude above sea level h is proportional to the pressure. That is, dP/dh = kP (k constant) Suppose that the pressure at sea level is...
-
In the verification of the amount of the inventory, one of the auditor's concerns is that slow-moving and obsolete items be identified. List the auditing procedures that can be used to determine...
-
Figure \(\mathrm{P} 28. 43\) shows two paths (A and B) around a wire that carries current \(I\). (a) Along which path is the line integral of the magnetic field greater? (b) Along which path is the...
-
Basalt plc is a wholesaler. The following is its trial balance as at 31 December 20X0. The following additional information is supplied: (i) Depreciate plant and machinery 20% on straight-line basis....
-
A 45-year-old man presents to the Emergency Department with a fever, widespread rash, and confusion. His only past history of note was Sydenham's chorea and a number of recent dental extractions....
-
KEW Enterprises began operations in January 20X1 to manufacture a hand sanitizer that promised to be more effective and gentler on the skin than existing products. Family members, one of whom was...
-
8. The apparent authority of a partner to bind the partnership in dealing with third parties a. Must be derived from the express powers and purposes contained in the partnership agreement. b. Will be...
-
Name the 3 types of tax rate structures, describe each, and give an example of each. Which tax structure does the IRS use? Why do you think this is the structure it uses and do you agree or disagree...
-
What is the best costing method for the Walt Disney Company and explain why you think this method will work best
-
You have a single s-orbital nearest neighbor tight-binding Hamiltonian for the Kagome lattice. Solve the band problem. Note that Kagome has three atoms per cell, so your Hamiltonian will be 3x3. Plot...
-
Give the prime-power factorization of each of these numbers. (a) 15 (b) 3375 (a) The prime-power factorization of 15 is (c) 37,000
-
If the buyer is registered for GST and uses the vehicle 1 0 0 % for business purposes what input tax credit ( GST paid ) will they be able to claim? Explain
-
You've worked hard, made a fair amount of money, and have a nice stock portfolio. You're also known among your friends as " the guy with the money." As with lottery winners, you've become a bit of a...
-
The sales department of P. Gillen Manufacturing Company has forecast sales in March to be 20,000 units. Additional information follows: Finished goods inventory, March 1 . . . . . . . . . . . . . . ....
-
The town of Blair determines that it requires $22.5 million in property tax revenues to balance its budget. According to the towns property tax assessor, the town contains taxable property that it...
-
Antonio County is assessing whether it should build a new correctional facility for nonviolent offenders. Currently offenders are housed in the county jail at a cost per inmate of approximately...
-
During 2014 the Lung Association received a contribution of marketable securities that were to be placed in a permanent endowment fund. Neither donor stipulations nor applicable state law requires...
-
Use the information in the preceding question to create a prototype of the report; use an automated tool such as Microsoft Access (or if you prefer, you can create a prototype the old-fashioned way...
-
Database centralization is one of a number of distribution options, but it violates the rule that data should be managed and stored in close proximity to its users. Discuss the reasons why many data...
-
What is the difference between a relational database schema and a database schema?
Study smarter with the SolutionInn App