1answer.
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]
3 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]3 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
you are a bank loan officer. carter has to come into your office and applied for a loan for a car.you ran his credit report, and
elena-14-01-66 [18.8K]

Answer:

Carter score falls within the range of scores, from 300 to 579, considered Very Poor. Score is significantly below the average credit score.

Explanation:

5 0
3 years ago
A pangram is a sentence that contains all the letters of the English alphabet at least once. For example, the quick brown fox ju
erma4kov [3.2K]
Do you want this in paragraph form ?
5 0
3 years ago
What is the easiest way to migrate data from quickbooks desktop to quickbooks online?
Iteru [2.4K]

The easiest way to migrate data from Quickbooks desktop to QuickBooks online is to Go to Company, then pick out Export Company File to QuickBooks Online. Select Start your export.

<h3>How lengthy does it take to emigrate from QuickBooks laptop to QuickBooks Online?</h3>

Common Deciding Factors to transform QuickBooks laptop to on-line. If you seek thru QuickBooks boards and on-line communities, you'll discover humans bringing up that it takes the handiest 15-half-hour to transform documents from QuickBooks Desktop to Online. Then, there could be customers bringing up the time taken to be as much as 24 hours.

Go to Company, then pick out Export Company File to QuickBooks Online. Select Start your export. Sign in as an admin for your QuickBooks Online business enterprise. Select Choose on-line business enterprise, and pick the QuickBooks Online business enterprise you need to update together along with your business enterprise file.

Read more about the QuickBooks :

brainly.com/question/24441347

#SPJ1

5 0
2 years ago
What is output? x=-2 y=-3 print (x*y+2)
Shalnov [3]

Answer:

=8

Aaaaaaaaaansjxjdjsaaaaaaa

Explanation:

-2*-3=6+2=8

8 0
3 years ago
30 POINTS! PLEASE ANSWER QUICK!!!
SpyIntel [72]

Answer:

your doctype comes first.

Explanation:

The first thing you should make sure to have in any HTML document you create is a "document type definition (DTD)" declaration.

it defines what elements and attributes are allowed to be used in a certain flavor of HTML

6 0
3 years ago
Other questions:
  • Individually or in a group find as many different examples as you can of physical controls and displays.a. List themb. Try to gr
    15·1 answer
  • Different between ocular and compound miscroscope
    13·1 answer
  • Using a wireless network without the network owner's permission is known as ________.
    15·1 answer
  • I want to be a teacher some day and i know this question------------- Humans have a nose to breath , but what do fishes use to h
    6·2 answers
  • The material placed around the ignition device to feed the flame in arson is referred to as
    8·1 answer
  • Assume the existence of a Building class with a constructor that accepts two parameters: a reference to an Address object repres
    7·2 answers
  • Inputting a range of numbers comprising a batch and then inputting each serially numbered document is characteristic of the cont
    11·1 answer
  • When attaching a file or files in outlook 365 you select the attach command and then select the files location
    5·1 answer
  • How to write a C++ program that lets the user guess if a randomly generated integer is even or odd then the computer lets them k
    6·1 answer
  • What should you try first if your antivirus software does not detect and remove a virus?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!