Sei sulla pagina 1di 11

Documentation to the Database Project

“ HOSTEL MANAGEMENT SYSTEM”

Mitm-f18-023 (sana aslam)


Mitm-f18-024(ahmad awise)
Contents
1 ABSTRACT ........................................................................................................................................ 3
2 INTRODUCTION ............................................................................................................................... 3
3 ARCHITECTURE ................................................................................................................................ 3
3.1 ERD ................................................................................................................................................ 3
3.2 Relational Table definition ............................................................................................................ 4
4 Database Objects Report - common information about database objects .................................... 4
5 Table Details Report - detail table information: ............................................................................. 6
5.1. Table Description. ................................................................................................................... 6
5.2. Columns’ names, types, length, nullable attribute. ................................................................ 6
5.3. Constraints description. ........................................................... Error! Bookmark not defined.
5.4. Index description...................................................................... Error! Bookmark not defined.
5.5. Tables which are referenced by foreign key. .......................................................................... 6
6 View Details Report - detail view information: ............................................................................... 6
6.1 View Description. .................................................................................................................... 6
6.2 Columns’ names, type, length. ............................................................................................... 7
6.3 Definition of a view ................................................................................................................. 7
7 Stored Procedure Details Report - detailed stored procedure’s information: . Error! Bookmark not
defined.
7.1 Stored procedure description. ................................................. Error! Bookmark not defined.
7.2 Parameters’ name, type, length. ............................................. Error! Bookmark not defined.
7.3 Definition of a stored procedure. ............................................ Error! Bookmark not defined.
8 Triggers Details Report – detail triggers information ..................................................................... 7
8.1 Triggers Description. ............................................................................................................... 7
8.1 Columns’ names, type, length. ............................................................................................... 7
8.1 Definition of a triggers ............................................................................................................ 7
9 IMPLEMENTATION APPROACH ....................................................................................................... 7
9.1 Music store database .................................................................................................................... 8
9.2 Music store application .................................................................. Error! Bookmark not defined.
9.3 Music store graphic user interface (GUI) ....................................... Error! Bookmark not defined.
10 CONCLUSION ............................................................................................................................. 11
11 REFERENCES ................................................................................. Error! Bookmark not defined.
1 ABSTRACT
The abstract view it can be extend and reduce according to requirements and thinking during
the designing project. This blog is design to implement the our project named as a hostel
management system.

2 INTRODUCTION
THE basic purpose of designing this project is to get rid from manual entry and record system and
try to give easy and simple database management system for hostel. this project is design to keep
the record of the student living in hostel, allocation of rooms, their monthly or semester wise dues
and many more things but we are trying to make management system as much as simple and easy
as we can , but we well try to cover all the basic elements use for hostel management database.

3 ARCHITECTURE
This section illustrates the architecture of the database using an Entity Relationship Diagram
(ERD) and a Relational Schema Definition. The ERD shows the overall structure and
communication in the database. The Relational Schema Definition describes the tables to be
created in the database.
3.1 ERD
The Entity Relationship Diagram describes the entities hostel, student, rooms, fee and furniture,
Mess, Mess-employee, Visitor. Each entity has a primary key. Many students will be living in
the hostel. Girls-hostel has many rooms for the accommodation of the students in which more
than one student accommodate their self. so each room has assigned different types of furniture
for the students so they can easily spend the time in room. THEER are many workers in the
Girls-hostel who work in the mess and hostel as well (cleaning, washing,). Every student must
be submit his fee in time so they can get the every facility in hostel.
ERD OF HOSTEL MANAGEMENT SYSTEM;

3.2 Relational Table definition


1. HOSTEL
2. STUDENTS
3. FEE
4. ROOM
5. FUNITURE
6. MESS
7. MESS-EMPLOYEE
8. VISITOR
STRUCTURE OF HOSTEL MANAGEMENT SYSTEM AND SHOW THERE RELATIONSHIP WITH EACH
OTHER.
Database Objects Report - common information about database
objects (hostel management system structure)
4 Table Details Report - detail table information:

5.1. Table Description.


Hostel , STUDENTS, FEE, ROOMS, MESS, MESS-EMPLOYEE, VISITOR, FUNITURE.

Many institutes provide the facility of hostel for girls and boys. but we are mentioning only Girls
here, almost all the working is is same in both hostels.

5.2. Columns’ names, types, length, attribute.


h-id, h-name, location, student-id, student-name, student-father name, department, dob, fee-
month, fee-status, mess-incharge, mess-name, mess-employee id, employee name, address, room –
id, name-of-students, furniture –id, furniture-ty

5.3. Tables which are referenced by foreign key.

Student

Fee

Rooms

Mess

5 View Details Report - detail view information:


6.1 View Description.
View can be used to reduce the complexity of the database sechema that we draw in sql. We can be
used as a mechanism to implement roe and column .
6.2 Columns’ names, type, length.
6 --------------------------------view-------------
7 create view vw_student
8 as
9 select*from student
10 inner join hostel
11 select student.stu_id=hostel.h_id;
12
13 select*from vw_FiveStar

6.1 Definition of a view


A view is nothing more than a saved SQL query. A view can also be considered as a virtual
table. Views can be used to present aggregated data and hide detailed data.

6 Triggers Details Report – detail triggers information


8.1 Triggers Description.
We create trigger that values should be insert,delete, update . basically trigger used in tables that
excute in database. It means we directally access our related information.

8.1 Columns’ names, type, length.


Create Trigger <Trigger name>

ON <table name>

After insert

As

Begin

<print statement>

end

8.1 Definition of a triggers


A trigger is a kind of stored procedure that automatically executes when an event
occurs in the database server.

7 IMPLEMENTATION APPROACH
The implementation consists of the three following main components.
9.1 Music store database
The database was provided by the University of Amsterdam. Database administrators were the
assistants of the course. The database has JDBC (Java database connectivity) support. The
creation of the tables is made by using the query language SQL. Two examples of the code are
included below:

create database g_hostel


use g_hostel
go
drop database g_hostel
create table student
(
stu_id int primary key,
stu_name varchar (25),
stu_f_name varchar (40),
age varchar(20) ,
DOB varchar (30),
Room_no int,
departement varchar (30),
)
insert into student values ('1','sana','malik','22','08-1-1997','005','Mitm')
insert into student values ('2','iqra','aslam','20','05-2-1998','006','bsit')
insert into student values ('3','noor','farooq','17','11-3-1999','007','adps')
insert into student values ('4','zobia','nwaz','19','22-5-1990','008','Msc')
insert into student values ('5','mahnoor','ali','21','08-4-1987','000','Mcs')
insert into student values('7','sara','rayaz','15','11-06-2004','002','mphil')
select*from student
drop table student

create table Room


(
r_id int primary key,
g_hostal_name varchar (30),
stu_name varchar (25),
)
drop table Room
insert into Room values('005','Five Star','sana')
insert into Room values('006','Five Star','iqra')
insert into Room values('007','Five Star','noor')
insert into Room values('008','Five Star','zobia')
insert into Room values('009','Five Star','mahnoor')
insert into Room values('004','Five Stare','sleeam')
select*from Room
create table Fee
(
f_month varchar (20),
f_stats varchar (30) ,
stu_name varchar (20) ,
st_id_no int primary key,
)
drop table Fee
insert into Fee values('March','Paid','sana','1')
insert into Fee values('May','Paid','iqra','2')
insert into Fee values('December','not paid','noor','3')
insert into Fee values('August','Paid','zobia','4')
insert into Fee values('Jun',' notPaid','mahnoor','5')
select*from Fee
create table hostel
(
h_id int primary key ,
h_name varchar (20) ,
no_of_student varchar (20),
location varchar (25),
)

insert into hostel values ('1', 'Five Star','5','Lahore')


drop table hostel
select*from hostel

create table Funiture


(
f_id int primary key ,
r_id int,
f_type varchar (26),
)

insert into Funiture values('90','005','chair')


insert into Funiture values('08','006','table')
insert into Funiture values('20','007','study table')
insert into Funiture values('01','008','bed')
insert into Funiture values('67','009','chair table')
select*from Funiture
drop table funiture

insert into Visitor values('456','1','sobia','1-May-2008')


insert into Visitor values('345','2','noor','3-March-2008')
insert into Visitor values('786','3','sana','5-July-2008')
insert into Visitor values('986','4','mahnoor','7-May-2008')
select*from Visitor
drop table Visitor

create table Mess


(
m_id int primary key,
m_incharge_name varchar (10),
m_schedual varchar (30),
)
insert into Mess values('001','Amna','Monday to Wednesday')
insert into Mess values('002','Musakn','thursday to Saturday')
select*from Mess
drop table Mess

create table Mess_Employee


(
Emp_id int primary key,
Emp_name varchar (30),
Address varchar (30),
b_name varchar (10),
)
insert into Mess_Employee values('001','Amna','st#1,h#22/4' ,'Five Stare')
insert into Mess_Employee values('002','Muskan','st#4,h#44/2' ,'Five Stare')
select*from Mess_Employee
drop table Mess_Employee

select*from student
right join fee
on student.stu_id=fee.st_id_no
--------------------------------view-------------
create view vw_student
as
select*from student
inner join hostel
select student.stu_id=hostel.h_id;

select*from vw_FiveStar

---------for trigger
create trigger insert_t
on student
after insert
as
begin
select*from inserted;
end
drop trigger insert_t

------for delete
create trigger delete_tr_Room
on Room
after delete
as
begin
select*from deleted
end
delete from Room
where r_id=4

-----for update
create trigger update_t
on Mess
after update
as
begin
select*from inserted
select*from deleted
end
update Mess set m_incharge_name='mawish'
where m_id=2;
alter trigger insert_t
on student
after insert
as
begin
select*from inserted;
end

--------------------------log trigger
create table log_tbl
(
log_id int primary key identity,
log_information varchar(max),
);
drop table log_tbl

create trigger tr_log_t


on room
after insert
as
begin
Declare @id int;
select @id=r_ID from inserted
insert into log_tabl values ('log_id'+ space(4)+ cast (@id as varchar(50))+space(4)+
'added'
+space(4)+cast(getdate() as varchar(50)))

end
select * from room
select*from log_tbl

drop trigger delete_tr_Room


select*from student
select*from Room
select*from Fee
select*from hostel
select*from Funiture
select*from Visitor_tr
select*from Mess
select*from Mess_Employee

8 CONCLUSION
AS mentioned earlier we will try to make our project easy and simple so it can be
implement at any level and can be productive and usefull for any hostel management
system. It develop that can easy to access and take admission any hostel seating in your
home through check website.

Potrebbero piacerti anche