注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
Please write Java code with mysql queries (as needed) for these 2 very simple problems. Note, try to have syntactically correct code.
Problem 1 :
You have a table called member which has 3 columns email, age_as_integer, gender - email is the primary key and age value is integer like 20, 30 , 40, 41, etc
a. We want to find out in this table which age has the most number of members
so let's say we have 50 records with age 20, and 60 with age 21, and 55 with age 23 and so on you need to get the answer 21 given that is the age for most number of members.
b. As a next step, we want to find a band of 5 years where we have most number of profiles so it can be age 1 to age 5 or age 2 to age 6 or age 15 to age 20 - any band of 5 yrs
where we have the most number of profiles (note number of members in a particular 5 year band are the sum of count of profiles associated with per year in that band of 5 years)
Problem 2 :
Write code to find elements in an array of integers that are not only duplicates but that are within 4 array index apart so in an example array of (1, 3, 4, 1, 2, 6, 1, 9, 8, 3)
we will get 1 as answer but not 3 because although 3 is duplicate the occurrence happens at more than 4 indices apart
求问大家,这个sql要怎么写~
本人只会写第一题的a
谢谢大家~~
|