Home > database >  SQL query as how the new fields to the new field on the condition
SQL query as how the new fields to the new field on the condition

Time:09-19

I want to find out the gender is male baby was born in 2010, after frequency is 00 end such as 100, 200, 300, 1000 baby name

SELECT the name, the count (name) as freq
The FROM Baby. Baby_names
WHERE year<2010 AND gender='M'
Group by name
The ORDER BY freq
Having a count (name) like '% 00';

CodePudding user response:

Having an error don't know how to achieve this should be how to write?

CodePudding user response:

SELECT the name, the count (name) as freq
The FROM Baby. Baby_names
WHERE year<2010 AND gender='M'
and name like '%'
Group by name
The ORDER BY freq

CodePudding user response:

 SELECT name, 
COUNT (name) AS freq
The FROM Baby. Baby_names
WHERE year & lt; 2010 AND gender='M'
GROUP BY name
HAVING a COUNT (NAME) % 100=0
The ORDER BY freq.
  • Related