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
Why is experience in their own factory setting
Nataly [62]

Answer:

How to Manage Manufacturing Operations Effectively

Ensure High-Quality Products. ...

Ensure High-Quality Equipment. ...

Know How To Maximize Resources. ...

Look Into Technological Advancements. ...

Check Your Customer Service. ...

Consider Reducing Waste. ...

Conclusion.

Explanation:

5 0
2 years ago
4.2.5 codehs text messages answer
N76 [4]

Answer:

public class TextMessage

{

   private String message;

   private String sender;

   private String receiver;

   

   public TextMessage(String from, String to, String theMessage)

   {

       sender = from;

       receiver = to;

       message = theMessage;

   }

   

   public String toString()

   {

       return sender + " texted " + receiver + ": " + message;

   }

}

4 0
2 years ago
What is the definition of bug?​
salantis [7]
In what way is it used?
3 0
3 years ago
A network administrator is reviewing a network design that uses a fixed configuration enterprise router that supports both LAN a
tester [92]

Answer:

a modular router

Explanation:

A modular router is a type of router that will provide multiple slots, this will enable the network engineer to either change or increase the number of space the router has.

A layer 3 switch cannot provide a WAN connectivity even though it can increase the number of ports on a router. The concept of PoE capability of any device have nothing to do with the number of ports it has. If the Engineer decides to use another fixed configuration router it will still lead to the same problem in the future because it cannot guarantee or provide the flexibility of future growth adaptation which can be given by a modular router if put in use.

8 0
3 years ago
All organizations need good quality cybersecurity to ensure _____. Select 4 options.
vova2212 [387]

Answer:

option 1

Explanation:

it is because they need better security for operational

7 0
2 years ago
Read 2 more answers
Other questions:
  • The OSHA Workplace Poster 3165 is optional for workplaces.<br> A) True<br> B) False
    13·2 answers
  • It is important that researchers design rigorous study methods to eliminate: a. inferences. b. the need for a CONSORT flow chart
    10·1 answer
  • Alison retrieved data from a company database containing personal information on customers. When she looks at the SSN field, she
    14·1 answer
  • Kevin manages the security for his company and is working to implement a kernel integrity subsystem for key servers. Of the foll
    9·1 answer
  • To answer the research question "How am I going to find the information I need on the tople?" the best thing Georgia should
    15·1 answer
  • Image-editing software is used to _____.
    15·2 answers
  • BEING TIMED HELP ASAP
    12·2 answers
  • Suppose testcircle1 and circle1 in listing 9.1 are in two separate files named testcircle1.java and circle1.java, respectively.
    14·1 answer
  • How can you relate the careers in Finance as BSIS students?
    15·1 answer
  • (Comparable interface) Write Rectangle class that implements the Comparable interface. Override the equals method so that two Re
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!