Sie sind auf Seite 1von 36

GROUP ASSIGMENT

Technology Park Malaysia


CT014-3.5-2-DWDS
Database and Web Database System
Group Members

Behzad Shoarian Sattari

[TP023828]

Jai Girdhar

[TP020440]

Arvin Raj Singh Gill

[TP027884]

Lecturer Name

HASBULLAH BIN OSMAN

Intake

UC2F1201IT/ISS

Hand Out Date

7 April 2012

Hand In Date

21 May 2012

Database and Web Database System | CT014-3.5-2

Workload Matrix

NAME

PROGRAMMING

DESIGN

DOCUMENTATION

Behzad
Shoarian
Satari

15

33

40

Arvin Raj
Singh Gill

15

33

40

Jai Girdhar

70

33

20

Database and Web Database System | CT014-3.5-2

Contents
Introduction.................................................................................................................... 3
Entity Relationship Modeling (Crow's Foot Notation)................................................................5
Entity Relationship Diagram (ERD)................................................................................... 5
ERD Explanation.......................................................................................................... 6
Normalization............................................................................................................. 7
First Normal Form (1NF).......................................................................................... 7
Second Normal Form (2NF)..................................................................................... 8
Third Normal Form (3NF)....................................................................................... 10
Fourth Normal Form (4NF)..................................................................................... 11
Business Rules.............................................................................................................. 12
Attribute Level........................................................................................................... 12
Entity level rules........................................................................................................ 12
Inter-Entity Level Rules............................................................................................... 12
Database Schema........................................................................................................... 13
Data dictionary.............................................................................................................. 14
SQL statement.............................................................................................................. 19
DDL Statement.......................................................................................................... 19
DML Statement.......................................................................................................... 29
System screen shots and Explanation.................................................................................. 32
References................................................................................................................... 36

Introduction

Database and Web Database System | CT014-3.5-2

The Lotus University lecturer schedule management system is designed to be used by


lecturers, students and admins. Each of these participants would have their own right and
permission upon accessing the system. These are all given based on their user class.
The goal of the system is to allow lecturers to publish their consultation hours schedule and once
published, students would be able to book appointments or slots based on the availability set in
the consultation schedule. The system would be made available on the internet so lecturers and
students would be able to access the system away from their Local Area Network which is within
the universities premise.
Proper security measures has been taken care as of to not allow any unauthorized user to access
the database system. The backend of the database is made available to an administrator with
proper credentials, and the administrator must be within the intranet network to access the
backend of the database.
Tasks that are to be performed by the system are organized and categorized into different pages
and each of these tasks and pages are bound by their own rules of authority. The task execution is
limited to the permission given to a certain user class and these permissions determine the pages
that are accessible by the said user class as well. For instance, only the admin would be allowed
to publish the time table according to the lecturers while the lecturers and students are only able
to view these published time tables.
The database structure has to be designed with a high level of optimization in mind. The database
would be handling a large amount of data on a daily basis therefore; it has to be designed to be
able to handle data without any degradation in performance in the long run. To achieve this, a
proper plan has to be structured.

The database is designed based on an Entity Relationship Diagram which defines the whole
structure of the system. From the Entity Relationship Diagram, a context containing Business
Rules is produced. The Business Rules ensures the integrity and correctness of the data. Once the
data is ensured to be precise, the tables containing these data would be normalized. Once

Database and Web Database System | CT014-3.5-2

everything is in place, a Data Dictionary would be designed and a database would be designed
from the required tables.
Once the database has been created, it would be linked to the frontend which is developed using
PHP. The frontend is an interface made available to users with proper credentials. Once logged
in, depending on the permission and user level, one could retrieve, store, update or delete data
from the database.

Database and Web Database System | CT014-3.5-2

Entity Relationship Modeling (Crow's Foot Notation)


Entity Relationship Diagram (ERD)

Database and Web Database System | CT014-3.5-2

ERD Explanation
MANY students can enroll and Belongs to ONE intake
ONE Intake has MANY Courses
ONE Course contains MANY Modules
ONE Intake is owned by ONE Department
ONE Department contains MANY Lecturers
ONE Lecturer teaches MANY Modules
ONE Lecturer can create MANY Consultation schedules
ONE Student reserves ONE Consultation Schedule
ONE Admin publishes MANY TimeTable
ONE Admin publishes MANY FYPSchedule
ONE Lecturer View ONE TimeTable
ONE Lecturer View ONE FYPSchedule
ONE Student View MANY TimeTable
ONE Student View ONE FYPSchedule

Database and Web Database System | CT014-3.5-2

Normalization
UnNormalized Form (UNF)
Weekly Time Table
Ttdate,intake_alias,InstructorFirstName,InstructorLastName,InstructorDOB,InstructorGender,Instructor
Address,InstructorYearEnrolled,IntakeYear,IntakeMonth,InstructorUsername,InstructorPassword,Course
Name,CourseCredit,DepartmentName,ModuleName,SlotFrom,SlotTo,DepratmentName,RoomName,Roo
mCapacity,VenueName,CourseName,DepartmentName,CourseCredits,ModuleName

First Normal Form (1NF)


Weekly Time Table
Ttdate,intake_alias,InstructorFirstName,InstructorLastName,InstructorDOB,InstructorGender,Instructor
Address,InstructorYearEnrolled,IntakeYear,IntakeMonth,InstructorUsername,InstructorPassword,Course
Name,CourseCredit,DepartmentName,ModuleName,SlotFrom,SlotTo,DepratmentName,RoomName,Roo
mCapacity,VenueName

Database and Web Database System | CT014-3.5-2

Second Normal Form (2NF)

Intake Table
IntakeAlias,IntakeYear,IntakeMonth,CourseName,CourseCredit,IntakeCa
pacity,DepartmentName.

Instructor Table
InstructorID,InstructorFirstName,InstructorLastName,InstructoAddress,I
nstructorYearEnrolled,
InstructorUsername,InstructorPassword,DepartmentName.

Course Table
CourseID,CourseName,DepartmentID

Room Table
RoomName,VenueID

Database and Web Database System | CT014-3.5-2

Venue Table
VenueName,VenueID

Department Table
DepartmentID,DepartmentName

Weekly Time Table


InstructorFirstName, InstructorLastName, InstructorAddress, InstructorYearEnrolled,
InstructorUsername,
InstructorPassword,IntakeAlias,IntakeYear,IntakeMonth,CourseName,IntakeCapacity,DepartmentName,
ModuleName,SlotTimeFrom,SlotTimeTo

Module Table
ModuleName,CourseName,IntakeAlias,IntakeYear,IntakeMonth,IntakeCa
pacity

Database and Web Database System | CT014-3.5-2

Third Normal Form (3NF)

Instructor Table
InstructorID,InstructorFirstName,InstructorLastName,InstructoAddress,I
nstructorYearEnrolled,
InstructorUsername,InstructorPassword,DepartmentID.

Department Table
DepartmentID,DepartmentName

Intake Table
IntakeAlias,IntakeYear,IntakeMonth,IntakeCapacity,CourseID

Course Table
CourseID,CourseName,DepartmentName

Module Table
ModuleID,ModuleName,CourseID

Database and Web Database System | CT014-3.5-2

10

Fourth Normal Form (4NF)

Weekly Time Table Slot Table


SlotID,InstructorID,ModuleID,SlotTimeFrom,SlotTimeTo,TTID

Weekly Time Table Table


TTID,TTDate,IntakeID

Course Table
CourseID,CourseName,DepartmentID

Department Table
DepartmentID,DepartmentName

Database and Web Database System | CT014-3.5-2

11

Business Rules

Attribute Level
Intakes are defined by the period of time. For example, if an intake is held in March, then
students who registered in March would be labeled as students of March intake.
Time for each Consultation_Schedule must be greater than 0, and lasts for 30 minutes.
Lecturers are allowed to use the "Feedback" option to request for changes in the
Timetable and FYPSchedule set by the Admin.

Entity level rules


Every Course is assigned to one department. An example is the IT Department, Business
Department, and Arts Department.
Every department would have a number of lecturers which would teach modules
according to their departments (IT / Business / Arts / etc.)
Every Course contains modules which are taught to students. The number of modules
must be greater than one.
Once a consultation Schedule is booked, the date of booking would be saved under
Date_Validation for the lecturer to approve.
The admin would not be allowed to publish the timetable if 2 classes are registered in the
same class at the same time.

Inter-Entity Level Rules


Each student can only reserve one slot of the lecturer's consultation hour at a time
Student should be new and mustnt exist in the system. No two identical students are
allowed to be registered in different intakes.
Only lecturers are allowed to access the feedback form in the timetable and FYPSchedule
page to request for changes from the admin.
Only lecturers are allowed to access the feedback form in the consultation schedule once
they cancel a reserved appointment.

Database and Web Database System | CT014-3.5-2

12

Database Schema

Data dictionary
Database and Web Database System | CT014-3.5-2

13

Table Name

Instructor

Table Name

Student

Table Name

Admin

Table Name

Column Name
Inst_id
Inst_first_name
Inst_last_name
Inst_gender
Inst_dob
Inst_address
Inst_year_enrolled
intake_id
Inst_username
Inst_password
Enabled

Data Type
Integer(11)
Vachar(45)
Vachar(45)
Varchar(45)
Vachar(45)
Vachar(45)
Year(4)
Integer(11)
Vachar(45)
Vachar(45)
Intiger(11)

Constraint
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null

Key
PK

Column Name
Stud_id
Stud_first_name
Stud_last_name
Stud_gender
Stud_dob
Stud_address
Intake_id
Stud_user_name
Stud_password
Enabled
Column Name
Admin_id
Admin_full_name
Admin_contact_no
Admin_address
Admin_username
Admin_password
Enabled

Data Type
Integer(11)
Vachar(45)
Vachar(45)
Vachar(45)
Vachar(45)
Vachar(45)
Integer(11)
Vachar(45)
Vachar(45)
Integer(11)
Data Type
Integer(11)
Varchar(45)
Varchar(45)
Varchar(45)
Varchar(45)
Varchar(45)
Integer(11)

Constraint
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Constraint
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null

Key
PK

Column Name
Cb_id
Stud_id

Data Type
Integer(11)
Integer(11)

Constraint
Not Null
Not Null

Key
PK

Database and Web Database System | CT014-3.5-2

FK

FK

Key
PK

14

Consultation

Table Name

Consultation
schedule slot

Table Name

Course

Table Name
Department

Table Name

Remark
cs_id
enabled

Vahchar(2222)
Integer(11)
Integer(11)

Allow Null
Not Null
Not Null

Column Name
Cs_id
Cs_date

Data Type
Integer(11)
Varchar(45)

Constraint
Not Null
Not Null

Cs_time
Room_id
Inst_id
Cs_date_validation
Enabled

Varchar(45)
Varchar(45)
Integer(11)
Varchar(45)
Integer(11)

Not Null
Not Null
Not Null
Not Null
Not Null

FK

Key
PK

FK
FK

Column Name
Course_id
Course_name
Course_credits
Dept_id
Enabled

Data Type
Integer(11)
Varchar(45)
archar(45)
Integer(11)
Integer(11)

Constraint
Not Null
Not Null
Not Null
Not Null
Not Null

Key
PK

Column Name
Dept_id
Dept_name
Enabled

Data Type
Integer(11)
Varchar(45)
Integer(11)

Constraint
Not Null
Not Null
Not Null

Key
PK

Column Name
Intake_id

Data Type
Integer(11)

Constraint
Not Null

Key
PK

Database and Web Database System | CT014-3.5-2

FK

15

Intake

Table Name

Login

Table Name

Module

Table Name

Presentation
schedule

Intake_year
Intake_month
Intake_capacity
Cousrce_id
Intake_alias
Enabled

Varchar(45)
Varchar(45)
Varchar(45)
Integer(11)
Varchar(45)
Integer(11)

Not Null
Not Null
Not Null
Not Null
Not Null
Not Null

Column Name
Login_id
Login_username
Login_password
Login_type
Login_user_id
Enabled

Data Type
Integer(11)
Varchar(45)
Varchar(45)
Varchar(45)
Integer(11)
Integer(11)

Constraint
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null

Key
PK

Column Name
Module_id
Module_name
Course_id
Enabled

Data Type
Integer(11)
Varchar(45)
Integer(11)
Integer(11)

Constraint
Not Null
Not Null
Not Null
Not Null

Key
PK

Column Name
Ps_id
Ps_date
Inst_id
Stud_id
Ps_type
Ps_time_from
Ps_time_to
Room_id
Enabled

Data Type
Integer(11)
Varchar(45)
Integer(11)
Integer(11)
Varchar(45)
Varchar(45)
Varchar(45)
Integer(11)
Integer(11)

Constraint
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null

Key
PK

Database and Web Database System | CT014-3.5-2

FK

FK

FK

FK
FK

FK

16

Table Name

Room

Table Name
Venue

Table Name
Weekly
timetables

Table Name

Weekly
Timetable slot

Column Name
Room_id
Room_name
Venue_id
Room_capacity
Enabled

Data Type
Integer(11)
Varchar(45)
Integer(11)
Varchar(45)
Integer(11)

Constraint
Not Null
Not Null
Not Null
Not Null
Not Null

Key
PK

Column Name
Venue_id
Venue_name
Enabled

Data Type
Integer(11)
Varchar(45)
Integer(11)

Constraint
Not Null
Not Null
Not Null

Key

Column Name
tt_id
tt_date
Intake_id
Enabled

Column Name
Slot_id
Inst_id
Module_id
Slot_time_from
Slot_time_to
tt_id
Enabled

Data Type
Integer(11)
Varchar(45)
Integer(11)
Integer(11)

Data Type
Integer(11)
Integer(11)
Integer(11)
Varchar(45)
Varchar(45)
Integer(11)
Integer(11)

Constraint
Not Null
Not Null
Not Null
Not Null

Constraint
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null
Not Null

FK

PK

Key
PK
FK

Key
PK
FK
FK

FK

SQL statement
DDL Statement
CREATE DATABASE `dwds` /*!40100 DEFAULT CHARACTER SET latin1 */$$

CREATE TABLE `admin` (

Database and Web Database System | CT014-3.5-2

17

`admin_id` int(11) NOT NULL AUTO_INCREMENT,


`admin_full_name` varchar(45) NOT NULL,
`admin_contact_no` int(11) NOT NULL,
`admin_address` varchar(45) NOT NULL,
`admin_username` varchar(45) NOT NULL,
`admin_password` varchar(45) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`admin_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1$$

CREATE TABLE `consultation_bookings` (


`cb_id` int(11) NOT NULL AUTO_INCREMENT,
`stud_id` int(11) NOT NULL,
`remarks` varchar(2222) DEFAULT NULL,
`cs_id` int(11) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`cb_id`),
KEY `fk_cb_stud_id` (`stud_id`),
KEY `fk_cb_cs_id` (`cs_id`),
CONSTRAINT `fk_cb_stud_id` FOREIGN KEY (`stud_id`) REFERENCES `student`
(`stud_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_cb_cs_id` FOREIGN KEY (`cs_id`) REFERENCES
`consultation_schedule_slots` (`cs_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1$$

CREATE TABLE `consultation_schedule_slots` (

Database and Web Database System | CT014-3.5-2

18

`cs_id` int(11) NOT NULL AUTO_INCREMENT,


`cs_date` date NOT NULL,
`cs_time` int(11) NOT NULL,
`room_id` int(11) NOT NULL,
`inst_id` int(11) NOT NULL,
`cs_date_validation` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON
UPDATE CURRENT_TIMESTAMP,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`cs_id`),
KEY `fk_cs_room_id` (`room_id`),
KEY `fk_cs_inst_id` (`inst_id`),
CONSTRAINT `fk_cs_room_id` FOREIGN KEY (`room_id`) REFERENCES `room`
(`room_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1$$

CREATE TABLE `course` (


`course_id` int(11) NOT NULL AUTO_INCREMENT,
`course_name` varchar(45) NOT NULL,
`course_credits` decimal(10,1) NOT NULL,
`dept_id` int(11) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`course_id`),

Database and Web Database System | CT014-3.5-2

19

KEY `dept_id` (`dept_id`),


CONSTRAINT `dept_id` FOREIGN KEY (`dept_id`) REFERENCES `department` (`dept_id`)
ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1$$

CREATE TABLE `department` (


`dept_id` int(11) NOT NULL AUTO_INCREMENT,
`dept_name` varchar(45) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`dept_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1$$

CREATE TABLE `instructor` (


`inst_id` int(11) NOT NULL AUTO_INCREMENT,
`inst_first_name` varchar(45) NOT NULL,
`inst_last_name` varchar(45) NOT NULL,
`inst_gender` varchar(45) NOT NULL,
`inst_dob` date NOT NULL,

Database and Web Database System | CT014-3.5-2

20

`inst_address` varchar(45) NOT NULL,


`inst_year_enrolled` year(4) NOT NULL,
`dept_id` int(11) NOT NULL,
`inst_username` varchar(45) NOT NULL,
`inst_password` varchar(45) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`inst_id`),
KEY `fk_instructor_dept_id` (`dept_id`),
CONSTRAINT `fk_instructor_dept_id` FOREIGN KEY (`dept_id`) REFERENCES
`department` (`dept_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1$$

CREATE TABLE `intake` (


`intake_id` int(11) NOT NULL AUTO_INCREMENT,
`intake_year` year(4) NOT NULL,
`intake_month` int(11) NOT NULL,
`intake_capacity` int(11) NOT NULL,
`course_id` int(11) NOT NULL,
`dept_id` int(11) NOT NULL,
`intake_alias` varchar(45) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`intake_id`),
KEY `fk_intake_course_id` (`course_id`),
KEY `fk_intake_dept_id` (`dept_id`),
CONSTRAINT `fk_intake_course_id` FOREIGN KEY (`course_id`) REFERENCES `course`
(`course_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,

Database and Web Database System | CT014-3.5-2

21

CONSTRAINT `fk_intake_dept_id` FOREIGN KEY (`dept_id`) REFERENCES `department`


(`dept_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1$$

CREATE TABLE `login` (


`login_id` int(11) NOT NULL AUTO_INCREMENT,
`login_username` varchar(45) NOT NULL,
`login_password` varchar(45) NOT NULL,
`login_type` int(11) NOT NULL,
`login_user_id` int(11) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`login_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1$$

CREATE TABLE `module` (


`module_id` int(11) NOT NULL AUTO_INCREMENT,
`module_name` varchar(45) NOT NULL,
`course_id` int(11) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`module_id`),
KEY `fk_course_id` (`course_id`),
CONSTRAINT `fk_course_id` FOREIGN KEY (`course_id`) REFERENCES `course`
(`course_id`) ON DELETE NO ACTION ON UPDATE NO ACTION

Database and Web Database System | CT014-3.5-2

22

) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1$$

CREATE TABLE `presentation_schedule` (


`ps_id` int(11) NOT NULL AUTO_INCREMENT,
`ps_date` date NOT NULL,
`inst_id` int(11) NOT NULL,
`stud_id` int(11) NOT NULL,
`ps_type` varchar(45) NOT NULL,
`ps_time_from` double NOT NULL,
`ps_time_to` double NOT NULL,
`room_id` int(11) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`ps_id`),
KEY `fk_ps_inst_id` (`inst_id`),
KEY `fk_ps_stud_id` (`stud_id`),

KEY `fk_ps_room_id` (`room_id`),


CONSTRAINT `fk_ps_inst_id` FOREIGN KEY (`inst_id`) REFERENCES `instructor`
(`inst_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_ps_room_id` FOREIGN KEY (`room_id`) REFERENCES `room`
(`room_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_ps_stud_id` FOREIGN KEY (`stud_id`) REFERENCES `student`
(`stud_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1$$

CREATE TABLE `room` (

Database and Web Database System | CT014-3.5-2

23

`room_id` int(11) NOT NULL AUTO_INCREMENT,


`room_name` varchar(45) NOT NULL,
`venue_id` int(11) NOT NULL,
`room_capacity` int(11) NOT NULL,
`enabled` varchar(45) NOT NULL DEFAULT '1',
PRIMARY KEY (`room_id`),
KEY `fk_venue_id` (`venue_id`),
CONSTRAINT `fk_venue_id` FOREIGN KEY (`venue_id`) REFERENCES `venue`
(`venue_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1$$

CREATE TABLE `student` (


`stud_id` int(11) NOT NULL AUTO_INCREMENT,
`stud_first_name` varchar(45) NOT NULL,
`stud_last_name` varchar(45) NOT NULL,
`stud_gender` varchar(45) NOT NULL,
`stud_dob` date NOT NULL,
`stud_address` varchar(45) NOT NULL,
`intake_id` int(11) NOT NULL,
`stud_username` varchar(45) NOT NULL,

Database and Web Database System | CT014-3.5-2

24

`stud_password` varchar(45) NOT NULL,


`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`stud_id`),
KEY `fk_student_intake_id` (`intake_id`),
CONSTRAINT `fk_student_intake_id` FOREIGN KEY (`intake_id`) REFERENCES `intake`
(`intake_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1$$

CREATE TABLE `venue` (


`venue_id` int(11) NOT NULL AUTO_INCREMENT,
`venue_name` varchar(45) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`venue_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1$$

CREATE TABLE `weekly_timetable_slots` (


`slot_id` int(11) NOT NULL AUTO_INCREMENT,
`inst_id` int(11) NOT NULL,
`module_id` int(11) NOT NULL,
`slot_time_from` double NOT NULL,
`slot_time_to` double NOT NULL,
`room_id` int(11) NOT NULL,
`tt_id` int(11) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',

Database and Web Database System | CT014-3.5-2

25

PRIMARY KEY (`slot_id`),


KEY `fk_tt_slots_inst_id` (`inst_id`),
KEY `fk_tt_slots_module_id` (`module_id`),
KEY `fk_tt_slots_room_id` (`room_id`),
KEY `fk_tt_slots_tt_id` (`tt_id`),
CONSTRAINT `fk_tt_slots_inst_id` FOREIGN KEY (`inst_id`) REFERENCES `instructor`
(`inst_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_tt_slots_module_id` FOREIGN KEY (`module_id`) REFERENCES
`module` (`module_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_tt_slots_room_id` FOREIGN KEY (`room_id`) REFERENCES `room`
(`room_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_tt_slots_tt_id` FOREIGN KEY (`tt_id`) REFERENCES
`weekly_timetables` (`tt_id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1$$

CREATE TABLE `weekly_timetables` (


`tt_id` int(11) NOT NULL AUTO_INCREMENT,
`tt_date` date NOT NULL,
`intake_id` int(11) NOT NULL,
`enabled` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`tt_id`),
KEY `fk_tt_intake_id` (`intake_id`),
CONSTRAINT `fk_tt_intake_id` FOREIGN KEY (`intake_id`) REFERENCES `intake`
(`intake_id`) ON DELETE NO ACTION ON UPDATE NO ACTION

Database and Web Database System | CT014-3.5-2

26

) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1$$

DML Statement
There are some of the DML statement exists in lotus university project such as:

SELECT a.*, c.intake_alias, b.*, d.module_name, e.inst_first_name, e.inst_last_name,


f.room_name, g.venue_name
FROM weekly_timetables as a
RIGHT JOIN weekly_timetable_slots as b ON b.tt_id = a.tt_id
LEFT JOIN intake as c ON c.intake_id = a.intake_id
LEFT JOIN module as d on d.module_id = b.module_id

Database and Web Database System | CT014-3.5-2

27

LEFT JOIN instructor as e on e.inst_id = b.inst_id


LEFT JOIN room as f on f.room_id = b.room_id
LEFT JOIN venue as g on g.venue_id = f.venue_id
WHERE a.intake_id = '$intakeId'
AND a.enabled = 1
AND b.enabled = 1

SELECT a.*, b.*, c.room_name, d.venue_name, e.inst_first_name, e.inst_last_name


from consultation_bookings as a
LEFT JOIN consultation_schedule_slots as b on b.cs_id = a.cs_id
LEFT JOIN room as c on c.room_id = b.room_id
LEFT JOIN venue as d on d.venue_id = c.venue_id
LEFT JOIN instructor as e on e.inst_id = b.inst_id
WHERE b.inst_id = '$_SESSION[userId]'
AND a.enabled = 1
AND b.enabled = 1
AND c.enabled = 1
AND d.enabled = 1
AND e.enabled = 1

Database and Web Database System | CT014-3.5-2

28

SELECT a.*, b.stud_first_name, b.stud_last_name, c.room_name, d.venue_name from


presentation_schedule as a
LEFT JOIN student as b ON a.stud_id = b.stud_id
LEFT JOIN room as c on c.room_id = a.room_id
LEFT JOIN venue as d on d.venue_id = c.venue_id
WHERE a.inst_id = '$_SESSION[userId]' AND a.enabled =

SELECT a.*, b.inst_first_name, b.inst_last_name, c.*, d.room_name FROM


presentation_schedule as a
LEFT JOIN instructor as b ON b.inst_id = a.inst_id
LEFT JOIN student as c ON c.stud_id = a.stud_id
LEFT JOIN room as d ON d.room_id = a.room_id
WHERE a.enabled = 1
AND b.enabled = 1
AND c.enabled = 1
AND d.enabled = 1
ORDER BY a.ps_id DESC

INSERT INTO login (login_username, login_password, login_type, login_user_id)


VALUES ('$_POST[txtUsername]', '$_POST[txtPassword]', 3, '$id'

Database and Web Database System | CT014-3.5-2

29

System screen shots and Explanation

Login Page user need enter username and password for login

Database and Web Database System | CT014-3.5-2

30

Admin page and features to add new entities

For add and edit Timetable by admin

Database and Web Database System | CT014-3.5-2

31

For add and edit presentation schedules

Instructor page for add consultation slots

Database and Web Database System | CT014-3.5-2

32

This page is for views and edits consultation slots by instructor

This page for student view to show the timetable

Database and Web Database System | CT014-3.5-2

33

View slots status by student users

References
W3school.com. (2010), HTML tutorial [Online] Available at :
http://www.w3schools.com/html/default.asp [Accessed 3 May 2012].
W3school.com.(2010) PHP Tutorial [Online] Available at:
http://www.w3schools.com/php/default.asp [accessed 4 may 2012].
Jackzheng.net (2010) CIS 3730 Designing and Managing Data. [online] Available at:
http://jackzheng.net/teaching/cis3730/ [Accessed: 18 May 2012].
www2.cs.uregina.ca (2009) Crow's Foot Notation. [online] Available at:
http://www2.cs.uregina.ca/~bernatja/crowsfoot.html [Accessed: 18 May 2012].
W3school.com. (2011). JavaScript Tutorial [Online] Available at:
http://www.w3schools.com/js/default.asp [Accessed 18 may 2012].

Database and Web Database System | CT014-3.5-2

34

Angela Bradley (2009). Learn SQL(MySQL) [Online]. Available at:


http://php.about.com/od/learnmysql/p/learn_sql_free.htm [Accessed 18 May 2012].
Robin Nixon (2009). Learn PHP My SQL & JavaScript [Online]. Available at:
http://lpmj.net/ [Accessed 14 May 2012 ]
.
Joel Simkhai (13 Jun 2008). Best way to learn MySQL? [Online]. Available at:
http://forums.mysql.com/read.php?10,214025 [Accessed 12 May 2012].
SiteCround.com (2010). How to display MySQL Data? [Online]. Available at:
http://www.siteground.com/tutorials/php-mysql/display_table_data.htm [Accessed 19
May 2012].

Database and Web Database System | CT014-3.5-2

35

Das könnte Ihnen auch gefallen