answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
klemol [59]
2 years ago
11

Harry Potter and his friends are at Ollivander's with Ron, finally replacing Charlie's old broken wand. Hermione decides the bes

t way to choose is by determining the minimum number of gold galleons needed to buy each non-evil wand of high power and age. Write a query to print the id, age, coins_needed, and power of the wands that Ron's interested in, sorted in order of descending power. If more than one wand has same power.
Computers and Technology
1 answer:
Step2247 [10]2 years ago
4 0

Answer:

SELECT a.id, ab.age, b.min_coins_needed, b.power

FROM(SELECT code, power, min(coins_needed) AS min_coins_needed

 from Wands

 group by power, code) AS b

JOIN Wands wa

 ON a.coins_needed = b.min_coins_needed AND a.code = b.code AND a.power = b.power

JOIN Wands_property AS ab  

 ON a.code = ab.code  

WHERE ab.is_evil = 0          

ORDER BY b.power desc, ab.age DESC;              

Explanation:  

SELECT statement is used to select the columns id, age, coins_needed and power of the wands that Ron's interested in.

It is required to get the minimum coins_needed so, min() aggregate function is used to return the minimum value of coins_needed. So this is how minimum coins needed for wands with same age and power are attained and the resultant set is given the name of min_coins_needed  using alias. This is then grouped by code and power using GROUP BY because code and age has one to one mapping.

Next the JOIN is used to combine columns from two or more relations. Here Wands and Wands_property are joined to obtain id and age.

WHERE clause is used to filter the wands that are not evil.

ORDERED BY is used to sort in order of power and age, the result obtained. DESC is used to sort the result in descending order of power and age.

You might be interested in
PLEASE HELP!!~~
Law Incorporation [45]

Answer:

A

Explanation:

7 0
2 years ago
What are the results of Maya’s conspicuous consumption? Check all that apply. - a lack of debt - stress about paying bills - a l
kifflom [539]

Answer:

stress about paying bills

a lack of money for other expenses

great electronic connectivity

Explanation:

The Maya classic period has seen the rise of conspicuous and mass consumption. In the given scenario all the expense her paid by credit cards and cash is rarely used. There will be a stress for paying bills. There will be lack of money available in hand for some routine expenses and mandatory purchases. It gives a great electronic connectivity. All the funds are considered as safe.

4 0
2 years ago
Cloud-based services can open doors to leveraging Artificial Intelligence (AI) without dramatically increasing risk. Which clien
vladimir1956 [14]

Answer:

Explanation:

The clients that would be best suited for this opportunity would be small business or business' that do not have the hardware/space resources necessary to create the computing power that they need. Instead, they can simply pay for these cloud-based services which provide all of the necessary computing/hardware power and resources necessary so that the company can easily fulfill all of their tasks without any problems. Bigger companies can easily pay for and implement their own hardware to solve their problems which may benefit them even more in the long-term.

7 0
1 year ago
The ______________________ are incident management personnel that the incident commander or unified command assign to directly s
postnew [5]

Answer:

The Command Staff are the incident management personnel that the incident commander or unified command assign to directly support the command function.

Explanation:

Based on the information retrieved from the ICS (Incident Command System), to handle properly incidents that occur, Command Staff are assigned by the incident commander or unified command.

8 0
2 years ago
The fractional_part function divides the numerator by the denominator, and returns just the fractional part (a number between 0
7nadin3 [17]

Answer:

part a

Explanation:

7 0
2 years ago
Other questions:
  • Which data type stores images and audio visual clips?
    15·1 answer
  • Using the expected format, of putting key information where the reader can’t find it, is an example of?
    8·2 answers
  • Distinguish multiple inheritance and selective inheritance in oo concepts.
    14·1 answer
  • Write a class called Counter that represents a simple tally counter, which might be used to count people as they enter a room. T
    9·1 answer
  • LensForAll is a company that sells affordable contact lenses on its website. The CEO of the company realizes that an app must be
    9·1 answer
  • We have an internal webserver, used only for testing purposes, at IP address 5.6.7.8 on our internal corporate network. The pack
    15·1 answer
  • When you add a zero to the right of a decimal number, it multiplies its value by 10 (For example, "15" becomes "150"). What simi
    10·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    9·1 answer
  • How to code 2.9.5: Four colored triangles {Code HS}
    10·1 answer
  • Factoring of integers. Write a python program that asks the user for an integer and then prints out all its factors. For example
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!