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 |
|
niape
Starting Member
4 Posts |
Posted - 2011-04-28 : 13:23:44
|
| I'm been trying to figure this out for the last few hours and i'm sure its something easy that i'm missing:1) Display counts of each grade2)Display professor lastname of professors |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-04-28 : 13:39:40
|
| Homework?I guess this is grading the professor that takes a class.you only need classes and grades for the first part. I take it you know how to join the tables. Do you know about the group by clause?For the second part you just need professors and classes.Get the professorID for professors that teach 1 class - just needs the classes tableUse that result to get the last name from the professor table==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
niape
Starting Member
4 Posts |
Posted - 2011-04-28 : 14:52:03
|
This is keeping track of my personal classes and personal gradesquote: Originally posted by nigelrivett Homework?I guess this is grading the professor that takes a class.you only need classes and grades for the first part. I take it you know how to join the tables. Do you know about the group by clause?For the second part you just need professors and classes.Get the professorID for professors that teach 1 class - just needs the classes tableUse that result to get the last name from the professor table==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.
|
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-04-28 : 15:01:06
|
| then - your design is a bit odd - why do you have a grades table?select g.grade, count(*)from classes cjoin grades gon g.classid = c.classidgroup by g.gradeselect lastnamefrom professors pwhere professorid in (select professorid from classes group by professorid having count(*) = 1)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
niape
Starting Member
4 Posts |
Posted - 2011-04-28 : 15:09:36
|
I was required to make three tablesquote: Originally posted by nigelrivett then - your design is a bit odd - why do you have a grades table?select g.grade, count(*)from classes cjoin grades gon g.classid = c.classidgroup by g.gradeselect lastnamefrom professors pwhere professorid in (select professorid from classes group by professorid having count(*) = 1)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.
|
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-04-28 : 15:24:21
|
| >> This is keeping track of my personal classes and personal grades>> I was required to make three tablesSounds even more like homework.If the requirement was just for 3 tables then it's not a good design. If the requirement gave the design then it's not a good course. Decide whether you want to follow these requirements or keep track of your classes and grades - a sql server database probably isn't a good choice for that.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
niape
Starting Member
4 Posts |
Posted - 2011-04-28 : 17:56:01
|
the requirement was for three tables I did the design. What would you recommend for design improvement?quote: Originally posted by nigelrivett >> This is keeping track of my personal classes and personal grades>> I was required to make three tablesSounds even more like homework.The requirement was for 3 tables, what would be a better design?If the requirement was just for 3 tables then it's not a good design. If the requirement gave the design then it's not a good course. Decide whether you want to follow these requirements or keep track of your classes and grades - a sql server database probably isn't a good choice for that.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy.
|
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-04-28 : 19:06:19
|
| ProfessorClassClassTaken - ProfessorID, ClassID, Grade==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|