Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
santhoshcool123
Starting Member
4 Posts |
Posted - 2012-03-09 : 06:20:14
|
| Hi, I am just a beginner to SQL queries. I am facing a bit trouble writing queries for this table. PID STATE CITY YOB POP---- ---------- ---------- ---------- ---- 101 KAR BAN 1990 2C 102 KAR BAN 1990 3C 103 KAR BAN 1990 4C 104 KAR BAN 1991 3C 105 KAR MYS 1991 6C 106 AP HYD 1991 4C 107 TN CHEN 1991 9C 108 TN CHEN 1993 3Ca. Display states that are having more than 5C populationb. Display population w.r.t. State, City, and populationc. Display city wise number of persons only if the total population is more than 1C excluding Kar and AP. The output should also not include years between 1990-1992,Thanks for the help |
|
|
jimoomba
Yak Posting Veteran
90 Posts |
Posted - 2012-03-09 : 07:11:37
|
| could you please be more specific on questions b and crams |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2012-03-09 : 07:57:09
|
| Homework? If so, post what you've tried and explain where you are stuck. We don't do people's homework for them.--Gail ShawSQL Server MVP |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-09 : 11:25:47
|
quote: Originally posted by santhoshcool123 Hi, I am just a beginner to SQL queries. I am facing a bit trouble writing queries for this table. PID STATE CITY YOB POP---- ---------- ---------- ---------- ---- 101 KAR BAN 1990 2C 102 KAR BAN 1990 3C 103 KAR BAN 1990 4C 104 KAR BAN 1991 3C 105 KAR MYS 1991 6C 106 AP HYD 1991 4C 107 TN CHEN 1991 9C 108 TN CHEN 1993 3Ca. Display states that are having more than 5C populationb. Display population w.r.t. State, City, and populationc. Display city wise number of persons only if the total population is more than 1C excluding Kar and AP. The output should also not include years between 1990-1992,Thanks for the help
hintsa.use filter condition using > operator b. use GROUP BY including state,cityc. filter on years outside 1990-1992GROUP BY cityfilter on count of persons for population > 1c------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|