Skip to content
Advertisement

How to find the drinker who ordered most amount of drinks in MYSQL?

So far I have been able to find the amount of drinks in a single day for EACH drinker.

I then need to insert into a sample database information about two new orders for a drinker who has ordered the most amount of drinks in one day. Here is where I am unsure of what to do exactly. Here is my attempt so far:

I am very new to MYSQL so any help would be greatly appreciated!

Here are the CREATE and INSERT statements:

Advertisement

Answer

I didn’t quite understand your question, but I think you need a trigger to insert this data:

at another table. I propopse you this trigger but before all create a table for example test to collect the data:

This is the test table:

Here is the trigger

I don’t know if this will help you, but I’m starting too, for more information on triggers, I give you this link: https://sql.sh/cours/create-trigger

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement