1. 1
INDOOR MAP PROJECT (ROOMS): CARNEGIE LIBRARY
JASH MEHTA
IST 659 FINAL PROJECT REPORT
2. 2
Table of Contents
Project Summary ……………………………………………………..3
Tables and Attributes ……………………………………………………..5
Entity Relationship Diagram ……………………………………………………..7
Business Rules …………………………………………………….10
Database Infrastructure …………………………………………………….10
SQL Scripts for Creating
and Inserting Sample Data
…………………………………………………….10
Major Data Questions …………………………………………………….16
Forms and
Reports(Interfaces)
…………………………………………………….18
Triggers …………………………………………………….22
3. 3
Summary:
The resources of the Carnegie include rooms that a SU user could use at the library.
For instance, there are rooms like Offices, Stack Area, Classrooms, Computer Lab,
Computer Cluster.
All rooms have resources such as chairs & table and technology. Classrooms can be
booked by faculty.
Therefore if faculty wants to know which rooms has sufficient capacity then the
faculty can log into the app to find out about the room he/she wants to book.
The resources can be located in a room or outside a room. These resources are
classified based on resource types and also based on the different levels they are
located on.
Supposedly, other resources include dust bins, elevators, exits and entrances in the
Carnegie Library. User (student or faculty) can log into the SU Indoor Map to find out
these other resources.
The scope of my project is limited to identify the rooms and other resources and
their locations at Carnegie so that these details can be fetched by the SU Indoor
Outdoor app.
Major Data Question
The App will be used by two kind of users
SU students and faculty
Database administrator
Why would SU students and faculty query the database?
Faculty has the privilege to book rooms in Carnegie Library therefore if any professor
would like to know information regarding the rooms then the database would be
queried
4. 4
Students would like to locate the rooms and respective events in the room. Also,
students & faculty would like to locate the other resources such as drinking fountain,
washrooms, entrance, exits and elevators.
Why would database administrator query the database?
The database administrator would query the database in the event of finding out the
current status of any room or event. Administrator would like to query in order to
update the database. For example, if the semester changes and the events in the
room needs to be changed then it responsibility of the administrator to change it.
Also, if there is any reconstruction or reordering of any of the rooms then the
administrator must make changes in the database.
5. 5
Tables & Attributes
Database object & Attributes Description
User User of the SU indoor Map
PK SUID
UserFirstName
UserLastName
Age
Email
Gender
UserType
Primary Key: Identifies the user uniquely
User’s First Name
User’s Last Name
Age of the user
SuEmail of the user
Gender of the user
Faculty or Student
Rooms Stores Information about all the rooms
PK RoomNumber
Department
Floor
RoomType
Timings
No_Of_Projectors
No_Of_Screens
NoOfChairs
NoOfTables
RoomAccess
Room Type
PK: Identifies the room uniquely
Under which department does the room
come
On which floor is the room located
Office, Classroom, Computer Lab etc
Opening and Closing Hours
Number of resources in the rooms:
Number of projectors, screens, chairs
and tables
Private or Public
Discriminator: Classroom(CR),
ComputerLab(CL), Office (O)
Other Resources Stores other resources such as
washrooms, bins, drinking fountain,
elevators, entrance and exits
PK ResourceID
FK SUID
ResourceName
Floor
Unique ID for resources to identify
resources
SUID taken as foreign key from the User
Table
Vending Machine, Washroom, Dustbin
Floor on which the resource is located
UserRoom Bridge table between user and Rooms
as it is many to many relationship
between user and rooms
6. 6
PK URid
FK SUID
FK RoomNumber
Start Time
End Time
Date
Uniquely identifies the booking for the
user and room
Foreign key from user table
Foreign key from Rooms table
Start time the room booked
End time of the room booked
The date for which room is booked
Computer Lab Stores Information about all the
computers in the room
PK,FK RoomNumber
NoOfComputers
NameOfPrinter
TypeOfPrinter
NameOfScanner
TypeOfScanner
Primary key as well as foreign key to
implement disjoint logic
Number of Computers
Name of the printer
Brand/Company of the printer
Name of the Scanner
Brand/Company of the scanner
Classroom Stores information regarding the
classrooms
PK, FK RoomNumber
FK ClassID
Primary key as well as foreign key to
implement disjoint logic
Class Stores information regarding the event
occurring in the classroom
PK ClassID
URid
School Year
Semester
Uniquely identifies the class which is
being conducted in the classroom
URid as foreign key from UserRoom
bridge table
The school year: For example 2016,
2017
Fall, Spring, Summer
Office Stores information regarding the
person and the contact in the office
PK, FK RoomNumber
PersonIncharge_FirstName
PersonIncharge_LastName
ContactNumber
Primary key as well as foreign key to
implement disjoint logic
First Name of the person
Last Name of the person
Phone number of the office
10. 10
Business Rules
Many users can use/search for many rooms
A user of the App may search for one or many other resources
The rooms are complete disjoint entities. A room can be a computer lab, computer cluster,
classroom, office or a stack area
One classroom can have one class at a given time
Database Infrastructure:
The database infrastructure is based on client-server model. SQL server is used as the database engine
and access is used as the interface design tool. Data is inserted, deleted, updated and queried from the
SQL server database with the help of forms on Access. Useful data stored on SQL database can also be
viewed with the help of reports generated through access.
SQL Scripts for Creating and Inserting Sample Data:
NOTE: I am giving only one insert script for each table rest of the data was inserted by access forms
CREATE TABLE CUSer
(
SUID CHAR(10)NOT NULL,
UserFirstName Varchar(30),
UserLastName Varchar(30),
UserAge INTEGER ,
UserEmail varchar(20),
UserGender Varchar(2),
User_Type Varchar(30),
CONSTRAINT SUID_PK PRIMARY KEY (SUID)
);
INSERT INTO CUSer Values
('12345678','Sachin','Tendulkar','44','saten@syr.edu','M','Faculty')
11. 11
CREATE TABLE CROOMS
(
RoomNumber Char(5) NOT NULL,
Department varchar(30),
CFLoor char(2) ,
Timings varchar(20) ,
No_Of_Projectors INTEGER,
No_Of_Screens INTEGER,
No_Of_Chairs INTEGER,
No_Of_Tables INTEGER,
Capacity INTEGER,
RoomAccess Varchar(30),
RoomType Varchar(30) NOT NULL CHECK (RoomType In ('CL','CR','O')),
CONSTRAINT RoomNumber_PK PRIMARY KEY (RoomNumber)
);
INSERT INTO CROOMS Values ('C108','ABC','2','8 am - 5pm',1,1,20,3,23,'public','CR')
CREATE TABLE Resources
(
ResourceID Varchar(30) NOT NULL,
16. 16
Major Data Questions
-User can know how many classrooms, offices, computer lab are on each floor
SELECT Count(CROOMS.RoomNumber) AS CountOfRoomNumber, CROOMS.RoomType, CROOMS.RoomAccess,
CROOMS.CFLoor
FROM CROOMS
GROUP BY CROOMS.RoomType, CROOMS.RoomAccess, CROOMS.CFLoor;
17. 17
- Admin can create report to generate semesterwise classes in Carnegie
Library
SELECT CUSer.UserFirstName, CUSer.UserLastName, ClassRoom.RoomNumber, Class.Semester,
Count(Class.classID) AS CountOfclassID
FROM CUSer INNER JOIN (UserRoom INNER JOIN (Class INNER JOIN ClassRoom ON Class.classID =
ClassRoom.classID) ON UserRoom.URid = Class.URid) ON CUSer.SUID = UserRoom.SUID
GROUP BY CUSer.UserFirstName, CUSer.UserLastName, ClassRoom.RoomNumber, Class.Semester
HAVING (((Class.Semester)='Fall'));
SELECT CUSer.UserFirstName, CUSer.UserLastName, ClassRoom.RoomNumber, Class.Semester,
Count(Class.classID) AS CountOfclassID
FROM CUSer INNER JOIN (UserRoom INNER JOIN (Class INNER JOIN ClassRoom ON Class.classID =
ClassRoom.classID) ON UserRoom.URid = Class.URid) ON CUSer.SUID = UserRoom.SUID
GROUP BY CUSer.UserFirstName, CUSer.UserLastName, ClassRoom.RoomNumber, Class.Semester
HAVING (((Class.Semester)='Spring'));
19. 19
Form to fill data into Crooms and Computer Lab tables
Form to fill data into User Table
20. 20
Reports for major data questions:
- Admin can create report to generate semester wise classes in Carnegie
Library
21. 21
-User can know how many classrooms, offices, computer lab are on each floor
22. 22
Trigger
Before Trigger
As you can see C203 has 20 chairs and 20 tables and capacity is 20.
What my trigger does is it updates capacity = chairs + tables
create trigger updateCRooms
ON CROOMS
FOR UPDATE
AS
BEGIN
UPDATE CROOMS
SET Capacity = a.Capacity
FROM (select c.RoomNumber AS rnum,(c.no_of_tables +i.No_Of_Chairs) As 'Capacity'
FROM CROOMS c Inner join inserted i
on i.RoomNumber = c.RoomNumber
)a
where Crooms.RoomNumber = a.rnum
End;
update CROOMS
set No_Of_Chairs= 20
where RoomNumber='C203'