Sie sind auf Seite 1von 69

Cover Page (Release Form) only for the SQL Midterm Exam and for the Final Project

Class:
Professor:
Term / Year:
Effort [minutes]
Student Name (s)
Assignment:
Date of Submission:

5432/3432 Database Systems


Dr. J.
Fall 2015
2700 minutes
Shannon Sergeant, John Hoyt,
Stephen Daniel, Chris Hanson
Database Final Project
11/30/2015

Your satisfaction with learning-experience with this assignment (please check one):
A. Very Useful
B. Somewhat Useful
C. Useless
Post Mortem required (type your important comments/lessons learned here):
This project has taught us much in the way of working together as a group and what is important
when designing a database. The first thing we took out of this was the importance of testing your
data model to truly make it concrete. The team also learned a little on conflict resolution and how
to deal with differing opinions and coming together to get the job done. For a more detailed Post
Mortem, please refer to the report.

Table of Contents

Executive Summary 3
Team Organization . 3
Scope .. 4
Functional Requirements 4
Future Opportunities . 4
SQL Queries 5
Logical Model .... 43
Referential Integrities ... 44
Physical Model .. 45
Transactions ... 46
Tables and Data Types .. 50
Denormalization ... 55
Database Testing .. 55
Application Planning .. 62
SQL Coding Standard . 62
Post Mortem ... 63
References 64

Executive Summary
The purpose for this project is to design a fully functional database for the Centers
for Teaching and Technology (CT2) for Georgia Southern University. CT2, which is split
into the Center for Online Learning (COL) and Center for Teaching and Learning (CTL),

provides a multitude of services for Georgia Southern faculty. These services include
workshops that provide on site training in Folio, certification in Quality Matters, and
improvements on teaching styles. CT2 also provides Instructional Design for courses
being developed online by various faculty. CT2 keeps track of faculty attendance at
workshops and tracks the progress of course development with CT2 Instructional
Designers. Team members Shannon Sergeant and Christopher Hanson, student
employees at CT2, attended several meetings with Instructional Designers to compile a
list of requirements that would be necessary to satisfy the database needs for CT2.
Team Organization
All team members assisted in the analysis of database requirements and design in
both logical and physical models. Each team member is responsible in developing
database queries.
Shannon Sergeant:
The team leader and responsible for overseeing the group members. Assisted in
gathering the necessary data for the database. Also assisted in the creation of the
population scripts.
John Hoyt:
Created the Logical and Physical models for the database as well as provided the
referential integrities for the models. Assisted in the design of the GUI. Assisted in the
creation of the population scripts
Stephan Daniel:
Lead developer and programmer of the GUI, content, and connections. Established
database connection, programmed application framework and logic. Debugger and case
tester.

Chris Hanson:
Assisted in the gathering of the necessary data for the tables. Tested and documented
the database. Created the written report for the database. Assisted in the creation of the
population scripts.
Scope

The scope of the CT2 database will cover a database for the various workshops as
well as the courses being developed through CT2. The team will provide a GUI that
connects to the database for ease of access. The group will also document the work
completed as well as the models and diagrams created during the project in a written
report.
Functional Requirements
The creation of this database should allow ease of access for the CT2 staff in regards
to information on workshops and courses that have been previously developed or are
currently in the process of development. This information can then be gathered and
used for quarterly reports. For example, you wish to know who attended the Folio
Quizzes workshop on October 22nd. The CT2 staff would use this database to search for
the attendance record for that particular workshop. Another example is that you wish to
know how many courses were developed through CT2 on a particular semester. The CT2
staff can use this database to search developed courses through filtering by semester.
The database should also be allowed to add and remove information as needed.
Future Opportunities
In the future the database can be expanded to include feedback reports for workshops.
As more information is added, a login screen can be added that grants access to specific
data necessary for one department (such as COL) but not the other.
This database type can be expanded and modified for other record based databases.
For example, Georgia Southern can use the database to keep track of courses offered in a
semester as well who is enrolled in those classes.

SQL Queries
Shannon Sergeant:

1. Search for which instructional designer taught a certain workshop


select e.fname, e.lname form employees e join instructional_designers
id on e.empID=id.empIDDesigner join workshop w on w.EmpIDofTeacher =
id.empIDDesigner where w.workshopid=5;

2. Search for how many times a particular course, in this case Calculus II, was developed
select count(coursename) as NumTimesDeveloped from courses where
coursename = 'Calculus II';

3. Search the IDs of all Teaching Assistants that have taken Five Week Training with the
Instructional Designer Kandi Cooper
select i.empidinstructor as Teaching_Assistants from instructors i
join Five_wk_Training fwt on fwt.training = i.training where role
='TA' and EmpIDDesigner = 626;

4. Returns the EmpID, Course Number, and semester a Computer Science course was
developed
select i.EmpIDinstructor as Instructor_ID, c.coursenumber as
Course_Number, c.cohortsemester as Semester_Developed from instructors
i join courses c on c.EmpIDInstructor=i.EmpIDInstructor join
departments dept on dept.departmentid = i.departmentid where
dept.departname in (select dept.departname from departments dept where
dept.departname = 'Computer Science');

5. Search for who was the Instructor for CSCI 7435 during the FA 09 cohort
select fname, lname from employees e join instructors i on e.EmpID =
i.EmpIDInstructor join courses c on c.EmpIDInstructor =
i.EmpIDInstructor where c.coursenumber = 'CSCI 7435' and
c.cohortsemester = 'FA 09';

10

6. Returns the courses that are set to become active in the Summer 2016 semester
select c.coursenumber as Course_Number, c.coursename as Course_Name
from courses c where semsteroffered = 'SU 16' order by c.coursenumber;

11

7. Selects the first and last names of distinct instructors that have taken a Folio training
workshop
select distinct e.fname, e.lname from employees e join instructors i
on e.EmpID = i.EmpIDInstructor join workshopAttendance wa on
wa.EmpIDInstructor = i.EmpIDInstructor join workshop w on w.workShopID
= wa.workShopID where w.workshoptype = 'Folio Training';

12

8. Selects the ID and full name of instructors that have taken Five Week Training during a
Non Cohort (NC) semester
select i.empIDInstructor as Instructor_ID, (e.fname + ' ' + e.lname)
as Instructor_Name from employees e join instructors i on e.EmpID =
i.EmpIDInstructor join five_wk_Traing fwt on fwt.training = i.training
where twt.cohort like 'NC-%' order by Instructor_Name;

13

9. Returns the names of all Instructional Designers that developed a course during the
Spring 10 semester

14

select e.fname, e.lname from employees e join Instructional_Designers


id on e.EmpID = id.EmpIDDesigner where exists (select c.EmpIDDesigner
from courses c join Instructional_Designers id2 on c.EmpIDDesigner =
id2.EmpIDDesigner where c.cohortsemester ='SP 10' and c.EmpIDDesigner
= id.EmpIDDesigner);

15

10. Selects all instructors who have taken APPQMR workshop


select i.EmpIDInstructor, e.fname, e.lname from employees e join
Instructors i on e.EmpID = i.EmpIDInstructor join workshopAttendance
wa on i.EmpIDInstructor = wa.EmpIDInstructor join workshop w on
w.workShopID = wa.workShopID where w.workshopname = 'APPQMR' order by
i.EmpIDInstructor desc;

John Hoyt:

1. how many courses did each instructor develop?


Select Fname, coursesTaught from employees e join

16
(select count(courseid)as coursesTaught, EmpIDInstructor from courses
group by EmpIDInstructor) x
on e.EmpID=x.EmpIDInstructor
order by coursesTaught desc;

2. How many workshops has each instructor attended and when was the last time they
attended the a workshop?

17
Select fname, max(dateoffered) as lastattended, count(Attendance) as
workshopsAttended
from workshopAttendance as w
join employees as e on e.EmpID=w.EmpIDInstructor
join workshop w2 on w2.workshopID=w.workshopID
group by fname
order by workshopsAttended desc;

18

3. how many courses were developed by each of the departments?


Select count(courseId) as courseDeveloped,
as c --dc.ChairID,

d.departname from courses

join deptChair as dc on c.chairId=dc.ChairID


join Departments as d on d.departmentid=dc.departmentid
group by

d.departname

order by courseDeveloped;

19

4. how many times did each instructional designer develop a course for each of the
colleges?

20
SELECT count(c.coursename) as courseCount, lname, c2.collegeName from
QM_Review_Team as q
join employees as e on e.EmpID=q.QMCord
join Courses as c on c.courseId=q.courseId
join Dean as d on d.DeanID=c.DeanID
join College_Info as c2 on c2.collegeName=d.collegeName
group by lname,c2.collegeName
order by courseCount desc;

21

22

5. How many teachers in total have used us to create a class?


Select count (x.EmpIDInstructor)
numberOfInstructorsThatCreatedClasses from
(SELECT max(courseid) as y, EmpIDInstructor from Courses group by
EmpIDInstructor) as x;

6. Which department chairs have developed courses through us?


SELECT lname+', '+fname as fullname, d2.departname from employees as e
join deptChair as d on d.ChairID=e.EmpID
join courses as c on e.EmpID=c.EmpIDInstructor
join Departments d2 on d.departmentid=d2.departmentid;

23

7. what TAs have developed courses with us?


SELECT coursename from courses

24
where EmpIDInstructor in (Select empid from employees
where title='Teaching assistant')

8. How many courses were developed in each of the cohort semesters?


SELECT count (SUBSTRING(cohortsemester,4,5)) as
NumberOfCoursesDeveloped, cohortsemester
from Courses group by cohortsemester

25
order by SUBSTRING(cohortsemester,4,5);

9. How many people attended all of the workshops done by an Instructional Designers?
SELECT count(EmpIDofTeacher), e.lname,e.fname from Workshop as w

26
join workshopAttendance as wa on wa.workShopID=w.workShopID
join employees e on w.empidofTeacher=e.EmpID
group by e.lname,e.fname;

10. What is the percentage of courses developed by each of the Instructional Designers?
SELECT count(courseid)/convert(float,(SELECT count(courseid) from
courses))*100 as percentOfDevelopedCourses,c.EmpIDDesigner
from courses

as c

27
join Instructional_Designers as id on c.EmpIDDesigner=id.EmpIDDesigner
group by c.EmpIDDesigner;

Stephen Daniel:

1)Who has the longest first name?


select top 1 fname from employees order by len(fname) desc

28

2)Select name dean of Coba


select fname,lname from employees where empid=(select top 1 deanid from dean where
collegename='coba' order by deanid desc)

29

3) Insert employee into the database


insert into employees values (660, 'Stephen', 'Daniel','Desinger',NULL,NULL);

4) Insert previous employee into Designers table.


insert into Instructional_Designers values (660,NULL, 'EAGLES2015', 'stephen-daniel','CTL');

30

5) Delete via cascade employee 660


DELETE FROM employees WHERE empid=660;
Employees Tables

Desingers Table

31
6) Who is the Peer Reviewer of team number 8?
select fname,lname from employees where empid=
(select empidinstructor from teamMember where teamnum=8 and role='peer reviewer');

7) Who has designed the most courses?


SELECT top 1 EmpIDDesigner, count(*) as Occurance
FROM courses
GROUP BY EmpIDDesigner
ORDER BY COUNT(*) DESC

32

8) Which College have most Departments


SELECT top 1 collegeName, count(*) as Occurance
FROM departments GROUP BY collegeName ORDER BY COUNT(*) DESC

33

9)List all the TAs in the Five Week Training


select fname,lname from employees where empid in ( select EmpIDDesigner from
Five_wk_Training where role='ta');

10) Find employee who had a password that wasnt the default password of
Eagles2015
select e.fname,e.lname,i.Username, i.password from Instructional_Designers as i join employees
e on i.EmpIDDesigner=e.empid where password !='Eagles2015'

34

Christopher Hanson:
1.

Who is the director of CT2?


select fname, lname from employees where title = 'CT2 Director';

35

2.

How many Folio Foundation workshops were taught in October 2015?


select count(WorkshopType) from Workshop
where WorkshopType='Folio Training'
and dateoffered>= '2015-10-01'
and dateoffered<= '2015-10-31';

36

3.

How many QM review team members completed the QM Orientation workshop?


select count(q1.workshopname) from (select e.fname, e.lname,
wk.shorkshopname from employees e
join instructors i on i.EmpIDInstructor = e.EmpID join teamMember
tm on tm.EmpIDInstructor=i.EmpIDInstructor
join workshopAttendance wa on
wa.EmpIDInstructor=tm.EmpIDInstructor join Workshop wk on
wk.workShopID=wa.workShopID
where wk.WorkshopType='Quality Matters')q1;

37

4.

Which QM Review Teams was Peter Berryman a Coordinator for?


select qm.teamnum form employees e join Instructional_Designers id on
id.EmpIDDesigner=e.EmpID join QM_Review_Team qm on
qm.QMCord=id.EmpIDDesigner where e.fname='peter' and
e.lname='berryman' order by teamnum asc;

38

5.

Which workshops were instructed by Claudia-Cornejo Happel?


select wk.workshopname from Workshop wk join Instructional_Designers
id on id.EmpIDDesigner=wk.EmpIDofTeacher join employees e on
e.EmpID=id.EmpIDDesigner where fname='Claudia' and lname='CornejoHappel';

39

6.

Who is the Course Representative for each Review Team and what department are they
from?
select e.fname, e.lname, d.departname from employees e join
Instructors i on i.EmpIDInstructor=e.EmpID join teamMember tm on
tm.EmpIDInstructor=i.EmpIDInstructor join Departments d on
d.departmentid=i.departmentid where tm.role='Course Representative';

40

7.

How many online courses were created by Wen-Ran Zhang?


select count(q1.coursename) from (select c.coursename from Courses c
join Instructors i on i.EmpIDInstructor=c.EmpIDInstructor join
employees e on e.EmpID=i.EmpID=i.EmpIDInstructor where e.fname='WenRan' and e.lname='Zhang')q1;

41

8.

How many team members are on multiple review teams and what team are they on?
select e.fname, e.lname,tm.teamnum from employees e join Instructors i
on i.EmpIDInstructor=e.EmpID join teamMember tm on
tm.EmpIDInstructor=i.EmpIDInstructor where tm.EmpIDInstructor in
(select EmpIDInstructor from teamMember group by EmpIDInstructor
having count(*)>1) order by tm.EmpIDInstructor;

42

9.

What workshop has the highest attendance?


select Workshopname, (numberOfAttendees) from Workshop as w1 join
(select count(attendance) as numberOfAttendees, workshopid from
workshopAttendance group by workShopID) as w2 on
w1.workShopID=w2.workShopID where numberofattendees in (select
max(numberOfAttendees) from Workshop as w1 join (select
count(attendance) as numberOfAttendees, workshopid from
workshopAttendance group by workShopID) as w2 on
w1.workShopID=w2.workShopID)

43

10. How many distinct workshop names are there?


select distinct workshopname from Workshop;

44

45

Logical Model

46

Referential Integrities

47

Physical Model

48

Transactions
The transactions used in the database application are adding and searching.

49

Adding is represented by a button that will add the fields from a group of field boxes
into the corresponding database.
Code for Add button:

private void button1_Click(object sender, EventArgs e)


{
if (comboBox1.SelectedIndex.Equals(0))// Courses selected
{
empIDTextBox.Text = textBox1.Text;
lnameTextBox.Text = textBox2.Text;
titleTextBox.Text = textBox3.Text;
fnameTextBox.Text = textBox4.Text;
emailTextBox.Text = textBox5.Text;
phoneNumberTextBox.Text = textBox6.Text;
m1++;
// textBox1.Text = m1.ToString();
try
{
try
{
this.Validate();
this.employeesBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.database1DataSet);
this.employeesBindingSource.AddNew();
textBox1.Text = m1.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
catch (SqlException ex)
{
MessageBox.Show(ex.ToString());
}
The Search is divided into two types, set and custom.

50

Set search allows you to fill in the field boxes and it will then search the corresponding
table for the results.
Code for one of the set searchs:

private void fillBy5ToolStripButton_Click(object sender, EventArgs e)


{
try
{
this.employeesTableAdapter.FillBy5(this.database1DataSet.employees,
fnameToolStripTextBox.Text);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
private void button4_Click(object sender, EventArgs e)
{
fillBy5ToolStrip.Visible = true;
}
private void lastnamesearchToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.employeesTableAdapter.lastnamesearch(this.database1DataSet.employees,
lnameToolStripTextBox1.Text);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox2.SelectedIndex.Equals(0)) {

51

dataGridView2.DataSource = employeesBindingSource;
fillBy5ToolStrip.Visible = true;
lastnamesearchToolStrip.Visible = true;
firstnamesearchToolStrip.Visible = true;
usernameToolStrip.Visible = false;
roleToolStrip.Visible = false;
}
else if (comboBox2.SelectedIndex.Equals(1)) {
dataGridView2.DataSource = instructional_DesignersBindingSource;
fillBy5ToolStrip.Visible = false;
lastnamesearchToolStrip.Visible = false;
firstnamesearchToolStrip.Visible = false;
usernameToolStrip.Visible = true;
roleToolStrip.Visible = true;
}
}
private void firstnamesearchToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.employeesTableAdapter.firstnamesearch(this.database1DataSet.employees,
titleToolStripTextBox.Text);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
Custom search allows the user to type in an sql query that will filter out the tables
allowing you to search for all the results you want.
Code for custom search:

private void button3_Click(object sender, EventArgs e)


{

select = textBox10.Text;

52

dataAdapter = new SqlDataAdapter(select, conn);


commandBuilder = new SqlCommandBuilder(dataAdapter);
table = new DataSet();
try
{
dataAdapter.Fill(table);
}
catch (SqlException ex)
{
MessageBox.Show("Invlad sql command");
}
dataGridView2.ReadOnly = true;
dataGridView2.DataSource = table.Tables[0];

Tables and Data Types


employees:

The employee table keeps track of all of the employees of Georgia Southern that are
either employed at CT2, Professors, Deans, and Department Chairs.

53

Instructional Designers:

The Instructional Designers table is a subtype of employees that keeps track of all
employees that have either taught a workshop at CT2 or assisted in the development of
the courses brought through CT2.

Instructors:

The Instructors table is a subtype of employees that keeps track of all employees who at
some point were instructors. These instructors have either attended the workshops,
completed some kind of review team, or have gone through course development
individually or through five-wk Cohort.

54

deptChair:

The deptChair table is a subtype of employees that keeps track of all department chairs
for each academic department at Georgia Southern. This includes those who are
currently a department chair at Georgia Southern and those who were in the past.

Dean:

The Dean table is a subtype of employees that keeps track of all deans for each college at
Georgia Southern. This includes those who are currently a dean at Georgia Southern and
those who were in the past.

College Info:

The College Info table keeps track of the different colleges on campus.

55

Departments:

The Departments table keeps track of the different academic departments on campus as
well as which college they belong to.

Courses:

The Courses table keeps track of all of the courses that have been developed or are
currently being developed through CT2.

56

five-wk Training:

The five-wk Training table keeps track of those instructors that were a part or are
currently a part of a five-wk training session.

Workshop:

The Workshop table keeps track of all the workshops that have been offered or currently
being offered at CT2.

workshopAttendence:

The workshopAttendence table keeps track of which instructors have attended each
workshop.

57

QM Review Team:

The QM Review Team table keeps track of the different QM review teams that were
created at CT2. Keeps track of the course details and QM coordinator for the review
team.

teamMember:

The teamMember table keeps track of each team member of a QM review team. A team
member is an instructor and has a particular role on a team.

58

Denormalization
Upon review of our database, it has been decided that our database needs some
denormalization to assist in optimizing the speed of access for certain tables. For
example, the teamMembers table needs to be split into two or more tables due to the
duplication of data. The team chose to keep the data model as is due to time constraints.
Database Testing
Viewing Employees

Adding new Employee

59

Viewing Instructors

Adding new Instructor

Viewing Instructional Designers

60

Viewing Deans

Viewing Department Chairs

61

Viewing Courses

Adding a new Course

Viewing College Info

62

Viewing Departments

Viewing 5 week training

63

Viewing Qm Review Teams

Viewing QM Review Team Members

64

Viewing Workshops

Adding a new Workshop

Viewing Workshop Attendance

65

Search

Custom Search

66

Application Planning
Purpose:

To give the employees at the Centers of Teaching and Technology the freedom to
manage data of the various services they provide . The database should give them the
ability to add new workshops, review teams, and cohorts. The database should keep a
record of the attendance for various workshops. The database should also provide the
ability to update information regarding the workshops as well as the various Instructors
who take them.
Concerns:

The concerns for this database are mainly making the database user friendly in
hopes to reduce the need for technical training so that the employees can access the
data.
Transactions:

Updating Workshop Information


Adding a new Workshop
Adding a new employee
Adding a new Instructor
Viewing the attendance for workshops

67

SQL Coding Standard


For this database we used SQL Server and integrated it using Visual Studio. To write
our queries, the team is using Visual Studio's ability to produce new queries. For
naming the tables, we used the name of the data being stored in those tables. For
example, the table that stores workshops is called workshops and the table that stores
deans is called Deans.

Post Mortem
Shannon Sergeant:

Throughout the process of designing and implementing the CT2 database, several
crucial lessons were learned. Having a solid data model is absolutely necessary.
Designing the data model with my team members was one of our biggest challenges, and
we still encountered mistakes that needed to be mended along the way. This project also
taught me the importance of conflict resolution. We all needed to communicate viable
solutions to any issue we encountered and then work together to implement those
solutions. As primary contact with CT2, I learned how to communicate with a client.
One of my responsibilities was to interpret the clients database needs then translate
those needs into our database model.
John Hoyt:

This project has helped me realize the struggles of working with a group of
programmers in the real world. Communication problems are constant, whether it is
bad naming conventions or someone repeating someone elses work because we are not
coordinated enough. We all need to watch what we say in frustration to other people.
Saying the wrong thing can cause friction which can halt progress. Assigning roles to
people is crucial, not just the next task because if someone finishes a task early they can
go back to what they are in charge of. Assigning roles also sets a more clear chain of
command for that area of work, like the data model. While everyone can contribute to it,
the person in charge of it needs to be kept up to date, to avoid infighting. I feel better

68

prepared for the large scale projects that I will be a part of after I graduate and go out
into the business world.
Stephen Daniel:

Designing, implementing, and running a fully functional and real life example of a
database has providing me valuable lessons concerning my future in database related
workspace. This project has provided very valuable feedback and experience all creating
and running a database. I have realized the absolute importance of and efficient data
modeling before implementing the database. Coding SQL statements with C# has
provided me very necessary experience for my future. Coding the database and GUI
allowed me to fully understand the ins and outs of a modeling and implementing a
database.

Christopher Hanson:

This project has taught me some vital lessons in both working in a group and
building the database. One of our key issues came when we were implementing our
database. The more we tested data the more we found our initial models to break. I
learned that is important to test your model thoroughly is absolutely necessary before a
fully implementing the database. Another lesson to be learned was how important it was
for all of the group members to be on the same page when it comes to implementing the
data. I myself, did this whenever I was preparing the data for the to be added to the
database in which I did somethings to the data that caused some confusion and a lot of
headache later when it came time to implement. This taught me to communicate for
effectively with me group members needs. Overall, I found this project to be a fulfilling
learning experience that I can take from when going into the workforce.
References
All data is real time data provided by Georgia Southerns Centers for Teaching and
Technology. (Data can be found in the project folder under Appendices).

69

Das könnte Ihnen auch gefallen