Toyu Database (Toy University DB)
Toyu is a drastically simplified toy university database adapted from Ricardo (textbook). It is used in lectures, classroom demonstrations, the first SQL homework assignment, the mid-term examination, and the final examination. Toyu will also be used in Mongodb's lectures and assignments.
1. Accessing Toyu DB
1.1 Installing Toyu DB in your computer
Installing MySQL:
See more about setting up MySQL server and client at firstSQL.html.
Creating and populating toyu:
MySQL creation script for creating toyu: Createtoyu.sql.txt (remove .txt while saving). You can execute it with the source command in MySQL command line prompt:
1.2 Remote access to toyu
mysql -h dcm.uhcl.edu -u dbguest -p
2. Toyu Documentation
2.3 Overview and Description
Toyu is a very drastically simplified database to support a toy university application. The goal is to make it extremely small so it can be used in our classes.
Students in toyu has unique student id. Their first names, last names, and accumulated credit hours (ach) should be stored.
There are departments or programs, such as Computer Science (CSCI). A department has a unique department code of four characters. It also has a name. The number of staff of a department should be stored. A student can have a major and a minor, which are programs represented by the department code.
A department is housed under a school. A school contains a unique code (e.g. CSE) and a unique name (e.g. 'College of Science and Engineering').
Faculty members are hired to work under a single department. Toyu stores a unique id, name, and rank of every faculty.
Toyu offers courses. A course has a unique id, rubric, number, title, and credit. A course is offered by a department so that the rubric of a course is the department code of the offering department. A class is an offering of a course in a semester. The semester, year, room, and the instructor should be recorded. An instructor is a faculty member.
Students enroll in classes. The grade and the number of alerts of each class enrollment is recorded. Grades are defined in toyu with a grade point. For example, the grade 'A' has a grade point of 4.0.
2.2 Simple schema and keys
Relations/tables (primary key underscored):
Grade(grade, gradePoint)
School(schoolCode, schoolName)
Department(deptCode, deptName, schoolCode, numStaff)
Faculty(facId, fname, lname, deptCode, rank)
Course(courseId, rubric, number, title, credits)
Class(classId, courseId, semester, year, facId, room)
Student(StuId, fname, lname, major, minor, ach, advisor)
Enroll(stuId, classId, grade, n_alerts)
Foreign keys:
1. Student(advisor) references Faculty(facId)
2. Student(major) references Department(deptCode)
3. Student(minor) references Department(deptCode)
4. Faculty(deptCode) references Department(deptCode)
5. Department(schoolCode) references School(schoolCode)
6. Enroll(stuId) references Student(stuId)
7. Enroll(classId) references Class(classId)
8. Enroll(grade) references Grade(grade)
9. Class(courseId) references Course(courseId)
10. Class(facId) references Faculty(facId)
11. Course(Rubric) references Department(deptCode)
2.3 Models and Diagrams
toyu_uml.jpg: an UML diagram created by Astah.
toyu.asta: the UML model in Astah file format.
toyu_access_relationship_diagram.jpg:
3. MongoDB
Toyu is also used in MongoDB in this class. See: IntroMongo.html.