Hi, I need help to go about doing this.
If I have a table, in the database containing fruits, price, quantity.
I want to arrange the price of the fruits into 3 groups of around the same average. How do I do this?
Thank you
Hi, I need help to go about doing this.
If I have a table, in the database containing fruits, price, quantity.
I want to arrange the price of the fruits into 3 groups of around the same average. How do I do this?
Thank you
Jump to PostHomework assignment?
You need to come up with the initial approach and then if you have specific questions or problems then you can post those and someone may be able to help you. If you haven't got a clue as to how to even start, then it's time to …
Jump to Postselect count(*) as num from table select * from table order by price limit 0, num/3 select * from table order by price limit num/3, num/3 select * from table order by price limit 2*num/3. num/3
not a mean price, set around 3 median price groups, you …
Homework assignment?
You need to come up with the initial approach and then if you have specific questions or problems then you can post those and someone may be able to help you. If you haven't got a clue as to how to even start, then it's time to hit the books, use your brain or give up.
I only had sql which arrange them into asc order and have arrays. the rest im not sure. but its okay. thanks anyway
select count(*) as num from table
select * from table order by price limit 0, num/3
select * from table order by price limit num/3, num/3
select * from table order by price limit 2*num/3. num/3
not a mean price, set around 3 median price groups, you can do the math to create means from the price data
Which mathematical / stat model are you using to group around a number?
Are you using ANOVA or similar?
//EDIT
disregard, I just reread the post
select count(*) as num from table select * from table order by price limit 0, num/3 select * from table order by price limit num/3, num/3 select * from table order by price limit 2*num/3. num/3
not a mean price, set around 3 median price groups, you can do the math to create means from the price data
what does the limit does? and what do you mean by set around 3 median price groups? Actually what i was thinking was to group the price into asc, then the first with the last in one group, the second first and the second last into another group and so on. so i create the array,
$group1 = new arraylist(1,6,11,20,25);
$group2 = new arraylist(2,7,12,29,24);
note: my number of fruit is fixed.
i am stuck here after that. Not sure how to link them together.
note: my number of fruit is fixed.
what does this mean? only 10 entries?
Not sure how to link them together.
link what together?
only 25 entries. link the array with the actually price in database.
rephrase the question
3 groups where the price of the item is around the same average
or
3 groups where the average price of the group is the same
25 items, only, its as simple to add a freking column for the group number
Even for a homework assignment this is a strange one
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.