You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATEVIEWFINANCIAL_REPORTASSELECTw.WebinarIDAS ID, w.WebinarNameAS Name, 'Webinar'AS Type, w.WebinarPrice*
(SELECTcount(*)
FROM OrderWebinars ow JOIN
OrderDetails od ONow.OrderDetailsID=od.OrderDetailsIDJOIN
Orders o ONod.OrderID=o.OrderIDWHEREow.WebinarID=w.WebinarID) AS TotalIncome
FROM Webinars w
UNIONSELECTc.CourseIDAS ID, c.CourseNameAS Name, 'Course'AS Type, c.CoursePrice*
(SELECTcount(*)
FROM OrderCourse oc JOIN
OrderDetails od ONoc.OrderDetailsID=od.OrderDetailsIDJOIN
Orders o ONod.OrderID=o.OrderIDWHEREoc.CourseID=c.CourseID) AS TotalIncome
FROM Courses c
UNIONSELECTs.StudiesIDAS ID, s.StudiesNameAS Name, 'Study'AS Type, s.StudiesEntryFeePrice*
(SELECTcount(*)
FROM OrderStudies os JOIN
OrderDetails od ONos.OrderDetailsID=od.OrderDetailsIDJOIN
Orders o ONod.OrderID=o.OrderIDWHEREos.StudiesID=s.StudiesID) +
(SELECTsum(sm.MeetingPrice)
FROM StudyMeeting sm JOIN
Subject sb ONsm.SubjectID=sb.SubjectIDWHEREsb.StudiesID=s.StudiesID) AS TotalIncome
FROM Studies s
Zestawienie przychodów dla każdego webinaru
CREATEVIEWWEBINARS_FINANCIAL_REPORTASSELECT ID AS'Webinar ID', Name, TotalIncome
FROM FINANCIAL_REPORT
WHERE Type ='Webinar'
Zestawienie przychodów dla każdego kursu
CREATEVIEWCOURSES_FINANCIAL_REPORTASSELECT ID AS'Course ID', Name, TotalIncome
FROM FINANCIAL_REPORT
WHERE Type ='Course'
Zestawienie przychodów dla każdego studium
CREATEVIEWSTUDIES_FINANCIAL_REPORTASSELECT ID AS'Study ID', Name, TotalIncome
FROM FINANCIAL_REPORT
WHERE Type ='Study'
Lista dłużników
CREATEVIEWLIST_OF_DEBTORSASSELECT DISTINCTs.StudentID,
s.FirstName,
s.LastName,
s.Email,
s.PhoneFROM Students s
WHERE StudentID NOT IN
(SELECT DISTINCTs.StudentIDFROM Students s JOIN Orders o ONs.StudentID=o.StudentIDJOIN OrderDetails od ONo.OrderID=od.OrderIDJOIN OrderWebinars ow ONod.OrderDetailsID=ow.OrderDetailsIDJOIN Webinars w ONow.WebinarID=w.WebinarIDWHEREo.OrderDate<w.WebinarDateUNIONSELECT DISTINCTs.StudentIDFROM Students s
JOIN Orders o ONs.StudentID=o.StudentIDJOIN OrderDetails od ONo.OrderID=od.OrderIDJOIN OrderCourse oc ONod.OrderDetailsID=oc.OrderDetailsIDJOIN Courses c ONoc.CourseID=c.CourseIDWHEREo.OrderDate< dateadd(day, -3,
(SELECTmin(cm.Date)
FROM CourseModules cm
WHEREcm.CourseID=c.CourseID))
UNIONSELECT DISTINCTs.StudentIDFROM Students s
JOIN Orders o ONs.StudentID=o.StudentIDJOIN OrderDetails od ONo.OrderID=od.OrderIDJOIN OrderStudies os ONod.OrderDetailsID=os.OrderDetailsIDJOIN Studies st ONos.StudiesID=st.StudiesIDWHEREo.OrderDate< dateadd(day, -3,
(SELECTmin(sm.Date)
FROM StudyMeeting sm
JOIN Subject sb ONsm.SubjectID=sb.SubjectIDWHEREsb.StudiesID=st.StudiesID))
UNIONSELECT DISTINCTs.StudentIDFROM Students s
JOIN Orders o ONs.StudentID=o.StudentIDJOIN OrderDetails od ONo.OrderID=od.OrderIDJOIN OrderStudyMeeting osm ONod.OrderDetailsID=osm.OrderDetailsIDJOIN StudyMeeting sm ONosm.StudyMeetingID=sm.StudyMeetingIDWHEREo.OrderDate< dateadd(day, -3,
(SELECTsm.DateFROM StudyMeeting sm
WHEREsm.StudyMeetingID=osm.StudyMeetingID)))
ANDs.StudentIDIN
(SELECT DISTINCTs.StudentIDFROM Students s
JOIN WebinarDetails wd ONs.StudentID=wd.StudentIDUNIONSELECT DISTINCTs.StudentIDFROM Students s
JOIN CourseModulesDetails cmd ONs.StudentID=cmd.StudentIDUNIONSELECT DISTINCTs.StudentIDFROM Students s
JOIN StudyMeetingDetails smd ONs.StudentID=smd.StudentIDUNIONSELECT DISTINCTs.StudentIDFROM Students s
JOIN StudiesDetails std ONs.StudentID=std.StudentID)
Raport o liczbie zapisanych osób na przyszłe wydarzenia
CREATEVIEWNUMBER_OF_PEOPLE_REGISTRED_FOR_FUTURE_EVENTSASSELECTw.WebinarIDAS ID, w.WebinarNameAS Name,
count(*) AS NumberOfParticipants, 'Webinar'AS Type, 'Online'AS Location
FROM Webinars w JOIN
WebinarDetails wd ONw.WebinarID=wd.WebinarIDWHERE WebinarDate > getdate()
GROUP BYw.WebinarID, w.WebinarNameUNIONSELECTcm.ModuleIDAS ID, cm.ModuleNameAS Name,
count(*) AS NumberOfParticipants, 'Course Module'AS Type, CASE WHEN cm.ModuleIDIN
(SELECTsmod.ModuleIDFROM StationaryModule smod) THEN 'Stationary' ELSE 'Online' END AS Location
FROM CourseModules cm JOIN
CourseModulesDetails cmd ONcm.ModuleID=cmd.ModuleIDWHEREcm.Date> getdate()
GROUP BYcm.ModuleID, cm.ModuleNameUNIONSELECTsm.StudyMeetingIDAS ID, sm.MeetingNameAS Name,
count(*) AS NumberOfParticipants, 'Study Meeting'AS Type, CASE WHEN sm.StudyMeetingIDIN
(SELECTsmeet.MeetingIDFROM StationaryMeeting smeet) THEN 'Stationary' ELSE 'Online' END AS Location
FROM StudyMeeting sm JOIN
StudyMeetingDetails smd ONsm.StudyMeetingID=smd.StudyMeetingIDWHEREsm.Date> getdate()
GROUP BYsm.StudyMeetingID, sm.MeetingName
Raport o liczbie zapisanych osób na przyszłe spotkania studyjne
CREATEVIEWNUMBER_OF_PEOPLE_REGISTERED_FOR_FUTURE_STUDY_MEETINGSASSELECT ID AS'Study Meeting ID', NumberOfParticipants, Location
FROM NUMBER_OF_PEOPLE_REGISTRED_FOR_FUTURE_EVENTS
WHERE Type ='Study Meeting'
Raport o liczbie zapisanych osób na przyszłe moduły w ramach kursów
CREATEVIEWNUMBER_OF_PEOPLE_REGISTERED_FOR_FUTURE_COURSE_MODULESASSELECT ID AS'Course Module ID', NumberOfParticipants, Location
FROM NUMBER_OF_PEOPLE_REGISTRED_FOR_FUTURE_EVENTS
WHERE Type ='Course Module'
Raport o liczbie zapisanych osób na przyszłe webinary
CREATEVIEWNUMBER_OF_PEOPLE_REGISTERED_FOR_FUTURE_WEBINARSASSELECT ID AS'Webinar ID', NumberOfParticipants, Location
FROM NUMBER_OF_PEOPLE_REGISTRED_FOR_FUTURE_EVENTS
WHERE Type ='Webinar'
Frekwencja na zakończonych wydarzeniach
CREATEVIEWATTENDANCE_SUMMARYASSELECTsmd.StudyMeetingIDAS'Event ID',
100*SUM(CAST(smd.PresenceASInt)) /COUNT(smd.Presence) AS [% Frequence],
'Study meeting'AS'Event type'FROMdbo.StudyMeetingDetailsAS smd INNER JOINdbo.StudyMeetingAS sm ONsmd.StudyMeetingID=sm.StudyMeetingIDWHERE (sm.Date< GETDATE())
GROUP BYsmd.StudyMeetingIDUNIONSELECTcmd.ModuleIDAS'Event ID',
100*SUM(CAST(cmd.PresenceASInt)) /COUNT(cmd.Presence) AS [% Frequence],
'Course module'AS'Event type'FROMdbo.CourseModulesDetailsAS cmd INNER JOINdbo.CourseModulesAS cm ONcmd.ModuleID=cm.ModuleIDWHERE (cm.Date< GETDATE())
GROUP BYcmd.ModuleIDUNIONSELECTwd.WebinarIDAS'Event ID',
100*COUNT(*) / (SELECTCOUNT(*) AS Expr1
FROMdbo.Students) AS [% Frequence],
'Webinar'AS'Event type'FROMdbo.WebinarDetailsAS wd INNER JOINdbo.WebinarsAS w ONwd.WebinarID=w.WebinarIDWHERE (w.WebinarDate< GETDATE())
GROUP BYwd.WebinarID
Frekwencja na zakończonych spotkaniach studyjnych
CREATEVIEWSTUDY_MEETINGS_ATTENDANCE_SUMMARYASSELECT [Event ID] AS'Study Meeting ID', [% Frequence]
FROM ATTENDANCE_SUMMARY
WHERE [Event type] ='Study Meeting'
Frekwencja na zakończonych modułach kursów
CREATEVIEWCOURSE_MODULES_ATTENDANCE_SUMMARYASSELECT [Event ID] AS'Course Module ID', [% Frequence]
FROM ATTENDANCE_SUMMARY
WHERE [Event type] ='Course Module'
Frekwencja na zakończonych webinarach
CREATEVIEWWEBINARS_ATTENDANCE_SUMMARYASSELECT [Event ID] AS'Webinar ID', [% Frequence]
FROM ATTENDANCE_SUMMARY
WHERE [Event type] ='Webinar'
Lista obecności na każde szkolenie
CREATEVIEWPRESENCE_LISTASSELECTsmd.StudyMeetingIDAS'Event ID', sm.Date, s.FirstNameAS [First Name],
s.LastName, CASE WHEN Presence =1 THEN 'Present' ELSE 'Absent' END AS [Presence information],
'Study Meeting'AS'Event type'FROMdbo.StudyMeetingDetailsAS smd INNER JOINdbo.StudentsAS s ONsmd.StudentID=s.StudentIDINNER JOINdbo.StudyMeetingAS sm ONsmd.StudyMeetingID=sm.StudyMeetingIDWHERE (sm.Date< GETDATE())
UNION ALLSELECTcmd.ModuleIDAS'Event ID', cm.Date, s.FirstNameAS [First Name],
s.LastName, CASE WHEN Presence =1 THEN 'Present' ELSE 'Absent' END AS [Presence information],
'Course module'AS'Event type'FROMdbo.CourseModulesDetailsAS cmd INNER JOINdbo.StudentsAS s ONcmd.StudentID=s.StudentIDINNER JOINdbo.CourseModulesAS cm ONcmd.ModuleID=cm.ModuleIDWHERE (cm.Date< GETDATE())
UNION ALLSELECTwd.WebinarIDAS'Event ID', w.WebinarDate, s.FirstNameAS [First Name],
s.LastName, CASE WHEN wd.StudentIDIN (SELECT StudentID
FROM Students) THEN 'Present' ELSE 'Absent' END AS [Presence information],
'Webinar'AS'Event type'FROMdbo.WebinarDetailsAS wd INNER JOINdbo.StudentsAS s ONwd.StudentID=s.StudentIDINNER JOINdbo.WebinarsAS w ONwd.WebinarID=w.WebinarIDWHERE (w.WebinarDate< GETDATE())
Lista obecności na każde spotkanie studyjne
CREATEVIEWSTUDY_MEETINGS_PRESENCE_LISTASSELECT [Event ID] AS'Study Meeting ID', Date, [First Name], LastName, [Presence information]
FROM PRESENCE_LIST
WHERE [Event type] ='Study Meeting'GROUP BY [Event ID], Date, [First Name], LastName, [Presence information]
Lista obecności na każdy moduł w ramach kursów
CREATEVIEWCOURSE_MODULES_PRESENCE_LISTASSELECT [Event ID] AS'Course Module ID', Date, [First Name], LastName, [Presence information]
FROM PRESENCE_LIST
WHERE [Event type] ='Course Module'GROUP BY [Event ID], Date, [First Name], LastName, [Presence information]
Lista obecności na każdy webinar
CREATEVIEWWEBINARS_PRESENCE_LISTASSELECT [Event ID] AS'Webinar ID', Date, [First Name], LastName, [Presence information]
FROM PRESENCE_LIST
WHERE [Event type] ='Webinar'GROUP BY [Event ID], Date, [First Name], LastName, [Presence information]
Spis wszystkich spotkań studyjnych z informacjami o kierunku studiów oraz ramach czasowych
CREATEVIEWALL_STUDIES_TIMETABLEASSELECTs.StudiesID, sm.StudyMeetingID, sm.MeetingName, sm.Date, sm.DurationTimeFROMdbo.StudiesAS s
INNER JOINdbo.SubjectAS su
ONs.StudiesID=su.StudiesIDINNER JOINdbo.StudyMeetingAS sm
ONsu.SubjectID=sm.SubjectID
Spis wszystkich modułów kursów z informacjami o kursie oraz ramach czasowych
CREATEVIEWALL_COURSES_TIMETABLEASSELECTc.CourseID, cm.ModuleID, cm.ModuleName, cm.Date, cm.DurationTimeFROM Courses AS c
INNER JOIN CourseModules AS cm
ONc.CourseID=cm.CourseID
Spis wszystkich webinarów wraz z ramami czasowymi
CREATEVIEWALL_WEBINARS_TIMETABLEASSELECTw.WebinarID, w.WebinarName, w.WebinarDate, w.DurationTimeFROM Webinars AS w