Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 days ago.
Improve this question
A median is defined as a number separating the higher half of a data set from the lower half. Query the median of the Northern Latitudes (LAT_N) from STATION and round your answer to decimal places.
select round(lat_n,4) from
(select
(case when count(*)%2 = 0 then sum (row_number(count(round((lat_n)/2,0))over(order by lat_n asc)+row_number(count round((lat_n/2+1),0)over( order by lat_n asc)))/2
else row_number((count round((lat_n)+1)/2),0)over( order by lat_n asc ) end )from station)
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have this kind of code
SELECT MONTH(date_entered) AS Month,sex, COUNT(*) AS Customer
FROM customer
GROUP BY month
ORDER BY Month
I want to split sex (M and F) for each month. But the result that I get combine both sex
You need to include sex in group by as well
SELECT
MONTH(date_entered) AS Month,
sex,
COUNT(*) AS Customer
FROM customer
GROUP BY
MONTH(date_entered),
sex
ORDER BY
Month
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
i have table like this
date , N°ProDUCT , QUANTIE_SELL
every day i sell pruduct
N°pruduct------quantite_sell
i want to show eatch pruduct with the sum of the quantite ?
exmpl :1----82
2-----70
3-----12
the sql statment ??
Write the below query :-
SELECT SUM(quantite_sell) from product GROUP BY Nprod;
Thanks
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Below is my database table.
what will be the sql query to calculate average score of all topic1 entries,of all topic2 entries and so on with where clause(where event_date between this to this)?
use group by
select topic_name, avg(score)
from my_table
where event_date between '2016-03-01' AND '2016-03-31'
group by topic_name
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have table orders(id, buyerEmail, paymentTime, finalPrice)
Mysql query to list customers purchase worth more than 50 million in the previous 3 months from 31.01.2014?
SELECT buyerEmail
FROM orders
WHERE paymentTime BETWEEN '2014-01-31' - INTERVAL 3 MONTH AND '2014-01-31'
GROUP BY buyerEmail
HAVING SUM(finalPrice) > 50000000
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I need to show the month with the highest number of quantity sold.
I don't know how to do that. Please help thank you.
I have:
id, prod_name, price, q_sold, month
the q_sold must sum up with the number of month input.
You can order your result by the sum and take only the first entry with limit 1
select `month`, sum(q_sold) as sold_sum
from your_table
group by `month`
order by sold_sum desc
limit 1