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
If you want an app to reach the largest possible audience, which two platforms should you use?
Papessa [141]

Android Studio for Android, and Xcode for Apple devices.

6 0
2 years ago
How to access Tor Browser on Android which is not rooted?
Mekhanik [1.2K]
An app you can look up on Google chrome called Aptoide has it on there for you to install.
7 0
3 years ago
If you increase the distance between two magnets, what will happen?
zheka24 [161]
The Magnetic attraction will decrease
6 0
3 years ago
Read 2 more answers
As described in class, what does the sender send to the receiver when using hashing for integrity and authentication? (Do not in
Nataliya [291]

Answer:

The answer is "secret key k".

Explanation:

When the sender sends the message, he/she may combine, it with the hidden key, and determines the hashing, when transmitting the information the digest is being sent, and also the message is transmitted through the connection.

when the receiver receives the message, still having the very same secret key, adding the Hidden Key then recalculating the hashing again. In this, two factors if another subsequent digest matches something, this message is sent.  

  • During transit, the message was certainly not changed.
  • Anybody with the private key – preferably even a preferred sender sent out this letter.
6 0
3 years ago
What are the advantages and disadvantages of UTF-8 compared to ASCII?
Romashka [77]

Answer:

UTF-8 and ASCII both are the character encoding.

In a system,every character has some binary representation,these are the method to encode them.Earlier only ASCII was there, for every character it uses 8 bits to represent.In ASCII only 8 bytes were there i.e 2^8 that is 256.We can't represent number beyond than 127 so it generate a need for other encoding to get into,these drawbacks lead to Unicode,UTF-8.

As ASCII codes only uses a single byte,UTF-8 uses upto 6 bytes to represent the characters.So we can save characters which are as long as 2^48 characters. We can read this encoding easily by the help of shift operators and it is also independent of byte order.

As messages on internet were transferred over 7 bit ASCII messages,so many mail servers removed this encoding.    

6 0
2 years ago
Other questions:
  • Jill needs to create a chart for technology club that shows what percentage of total students in the school play video games. Wh
    11·2 answers
  • What component of a motherboard is not considered to be a field replaceable unit?
    12·1 answer
  • vulnerability is a feebleness which allows an attacker to condense a system's information assurance to security,is it true or fa
    14·1 answer
  • 2) Search the Web for two or more sites that discuss the ongoing responsibilities of the security manager. What other components
    15·1 answer
  • 1. Digital videos look sharpest when they are displayed at a resolution that is larger than the frame size.
    6·1 answer
  • Tell me at list 5 farm animals dieases​
    10·2 answers
  • When you open a browser window, it open in a _____. <br> a. fieldb. folderc. menud. window?
    7·1 answer
  • HELP ASAP, AND YES I KNOW, WRONG CATEGORY. SORRY!
    10·2 answers
  • Pls say correct guyz pls pls pls
    7·1 answer
  • rapid prototyping could be an advantageous methodology for developing innovative computer-based instruction. Software engineers
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!