在武术中,导师也是学生 - 所以Instructor
表被分为Student
表格。所有常见字段均在Student
表中,只有教师特定的字段位于Instructor
表中。
Art
表格有学校提供的艺术列表(柔道,空手道......)。
学校可能有几个房间,这些都列在Room
表中。
ClassSchedule
描述了学校提供的课程的公布时间表。
考勤记录在Attendance
表中。
Calendar
表中的一行是一个日历日(日期)。该表具有日期属性,如DayOfWeek
,MonthName
,MonthNumberInYear
等在TimeTable
一行是一天一分钟,喜欢7:05。
日历和时间表允许通过的日期/时间容易考勤报表,例如
-- Attendance of judo morning classes
-- for the first three months of the year 2010
-- by day of a week (Sun, Mon, Tue, ..)
select
DayOfWeek
, count(1) as Students
from ClassSchedule as a
join Calendar as b on b.CalendarId = a.CalendarId
join TimeTable as c on c.TimeID = a.StartTimeId
join Attendance as d on d.ClassId = a.ClassID
join Art as e on e.ArtId = a.ArtID
where ArtName = 'judo'
and Year = 2010
and MonthNumberInYear between 1 and 3
and PartOfDay = 'morning'
group by DayOfWeek ;
希望这可以让你开始。
您的回答和Damir的回答已经回答了我所有的问题。感谢您的帮助。 – 2010-10-16 00:49:59