Upload
mustafa-kazmi
View
14
Download
0
Embed Size (px)
DESCRIPTION
Assignment method
Citation preview
Assignment # 01
Course: CSC271
Student: Nasir Majeed Kayani 40962
Fa15mcs016
Q. No.1: Identify all possible relations with attributes of a University database. Also mention the
following of each relation
Super key
Candidate key
Primary key
Alternate key
Foreign key
Cardinality
Degree
Answer:
Relations of a University Database
Database of a University normally stores information related to Employees, Departments, Students and
Courses. Let us define key relations for a University Database.
ORGANIZATION
Attributes:
1. OrganizationID
2. OrganizationName
3. Founded
4. Website
Organization Relation normally will have only one record in University Database but it can be easily
made scalable to handle more than one university record by adding OrganizationID attribute in rest of
relations as Foreign Key, just like in Campus Relation.
OrganizationID OrganizationName Founded Website
1 University of the Punjab 1882 www.pu.edu.pk
Super Key OrganizationID
OrganizationID, Founded
OrganizationID, Website
OrganizationName, Website
OrganizationName, Founded, Website
OrganizationID, OrganizationName, Website
OrganizationID, OrganizationName, Founded
OrganizationID, OrganizationName, Founded, Website
Candidate Key OrganizationID
OrganizationName, Website
Primary Key OrganizationID
Alternate Key OrganizationName, Website
Foreign Key None
Cardinality 1
Degree 4
CAMPUS
Attributes:
1. CampusID
2. OrganizationID
3. CampusName
4. Address
CampusID OrganizationID CampusName Address
1 1 Quaid-e-Azam 123, Canal Raod, Lahore
2 1 Gujranwala 111, Main Road, Gujranwala
3 1 Jhelum 55, City Road, Jhelum
Super Key CampusID
CampusID, OrganizationID
CampusID, OrganizationID, CampusName
CampusID, OragnizationID, CampusName, Address
CampusID, CampusName, Address
CampusID, CampusName
CampusID, Address
OrganizationID, CampusName
OranizationID, CampusName, Address
OrganizationID, Address
CampusName, Address
Candidate Key CampusID
OrganizationID, CampusName
Primary Key CampusID
Alternate Key OrganizationID, CampusName
Foreign Key OrganizationID
Cardinality 3
Degree 4
DEPARTMENT
Attributes:
1. DepartmentID
2. DepartmentName
3. Description
DepartmentID DepartmentName Description
1 Human Resource HR Department for all campuses
2 Accounts Main Accounts Department
3 English English Language and Linguistic Department
Super Key DepartmentID
DepartmentID, DepartmentName
DepartmentID, DepartmentName, Description
DepartmentID, Description
DepartmentName, Description
Candidate Key DepartmentID
DepartnameName, Description
Primary Key DepartmentID
Alternate Key DepartmentName, Description
Foreign Key None
Cardinality 3
Degree 3
CONTACT
Attributes:
1. ContactID
2. CampusID
3. ContactName
4. Description
5. ContactNumber
ContactID CampusID ContactName Description ContactNumber
1 1 Registrar Office L Registrar Office Telephone Number
0092-42-12345678
2 1 Registrar Office F Registrar Office Fax 0092-42-12355555
3 2 Reception & Information Cell L
First Point of Contact Telephone
0092-431-1247777
Super Key ContactID
ContactID, CampusID, ContactName, Description
ContactID, CampusID, ContactName, Description, ContactNumber
Candidate Key ContactID
CampusID, ContactName, ContactNumber
Primary Key ContactID
Alternate Key CampusID, ContactName, ContactNumber
Foreign Key CampusID
Cardinality 3
Degree 5
EMPLOYEE
Attributes:
1. EmployeeID
2. FullName
3. CNIC
4. DateOfBirth
5. ContactNumber
6. EmailAddress
EmployeeID FullName CNIC DateOfBirth ContactNumber EmailAddress
1 Ahmed Ali 1234-678912-5 01-03-1985 00923335555666 [email protected]
2 Abdul Basit 2222-555555-9 03-03-1985 00923005554446 [email protected]
3 Ali Nawaz 1111-555555-2 04-04-1980 00923335544666 [email protected]
Super Key EmployeeID
CNIC
EmailAddress
EmployeeID, FullName
EmployeeID, FullName, CNIC
EmployeeID, FullName, CNIC, DateOfBirth
EmployeeID, FullName, CNIC, DateOfBirth, ContactNumber
EmployeeID, FullName, CNIC, DateOfBirth, ContactNumber, EmailAddress
FullName, CNIC
FullName, CNIC, DateOfBirth
FullName, CNIC, DateOfBirth, ContactNumber
FullName, CNIC, DateOfBirth, ContactNumber, EmailAddress
CNIC, DateOfBirth
CNIC, DateOfBirth, ContactNumber
CNIC, DateOfBirth, ContactNumber, EmailAddress
CNIC, EmailAddress
CNIC, ContactNumber
Candidate Key EmployeeID
CNIC
EmailAddress
CNIC, EmailAddress Primary Key EmployeeID
Alternate Key CNIC
EmailAddress
CNIC, EmailAddress
Foreign Key None
Cardinality 3
Degree 6
FACULTY
Attributes:
1. FacultyID
2. EmployeeID
3. DepartmentID
4. Designation
FacultyID EmployeeID DepartmentID Designation
1 2 3 Professor
2 3 3 Associate Professor
Super Key FacultyID
FacultyID, EmployeedID
FacultyID, EmployeedID, DepartmentID
FacultyID, DepartmentID , Designation
FacultyID, EmployeedID, DepartmentID, Designation
EmployeedID, DepartmentID
EmployeedID, DepartmentID, Designation
Candidate Key FacultyID
EmployeeID, DepartmentID
Primary Key FacultyID
Alternate Key EmployeeID, DepartmentID
Foreign Key EmployeeID
DepartmentID
Cardinality 2
Degree 4
CLASS
Attributes:
1. ClassID
2. ClassName
3. ClassSection
4. NoOfStudent
ClassID ClassName ClassSection NoOfStudent
1 MA English A 25
2 MA English B 23
Super Key ClassID
ClassID, ClassName
ClassID, ClassName, ClassSection
ClassID, ClassName, ClassSection, NoOfStudent
ClassName, ClassSection
ClassName, ClassSectin, NoOfStudent Candidate Key ClassID
ClassName, ClassSection
Primary Key ClassID
Alternate Key ClassName, ClassSection
Foreign Key None
Cardinality 2
Degree 4
COURSE
Attributes:
1. CourseID
2. CourseName
3. Description
CourseID CourseName Description
1 MA English Master Degree Program in English Literature and Linguistic
2 MA Urdu Master Degree Program in Urdu Language and Literature
Super Key CourseID
CourseID, CourseName
CourseID, CourseName, Description
CourseName, Description
CourseID, Description
Candidate Key CourseID
CourseName, Description
Primary Key CourseID
Alternate Key CourseName, Description
Foreign Key None
Cardinality 2
Degree 3
STUDENT
Attributes:
1. StudentID
2. FullName
3. CNIC
4. RegistrationNumber
5. DateOfBirth
6. CourseID
7. ContactNumber
8. EmailAddress
StudentID
FullName CNIC RegistrationNumber
DateOfBirth CourseID ContactNumber EmailAddress
1 Amjad Ali 1234-678912-1 12345 01-03-1988 1 0092333554446 [email protected]
2 Raja Basit 2222-55355-3 12346 03-03-1989 2 0092344455555 [email protected]
3 Munawar Khan 1111-554555-6 12347 04-04-1989 1 0092303557894 [email protected]
Super Key StudentID
CNIC
RegistrationNumber
StudentID, FullName
FullName, CNIC
CNIC, RegistrationNumber
StudentID, FullName, CNIC
StudentID, FullName, CNIC, RegistrationNumber
StudentID, FullName, CNIC, RegistrationNumber, DateOfBirth
StudentID, FullName, CNIC, RegistrationNumber, DateOfBirth, CourseID
StudentID, FullName, CNIC, RegistrationNumber, DateOfBirth, CourseID, ContactNumber
StudentID, FullName, CNIC, RegistrationNumber, DateOfBirth, CourseID, ContactNumber, EmailAddress
FullName, CNIC, RegistrationNumber, DateOfBirth
FullName, CNIC, RegistrationNumber, DateOfBirth, CourseID
FullName, CNIC, RegistrationNumber, DateOfBirth, CourseID, ContactNumber
FullName, CNIC, RegistrationNumber, DateOfBirth, CourseID, ContactNumber, EmailAddress
CNIC, RegistrationNumber, DateOfBirth
CNIC, RegistrationNumber, DateOfBirth, CourseID
CNIC, RegistrationNumber, DateOfBirth, CourseID, ContactNumber
CNIC, RegistrationNumber, DateOfBirth, CourseID, ContactNumber, EmailAddress
Candidate Key
StudentID
CNIC
RegistrationNumber
EmailAddress
FullName, CourseID
Primary Key StudentID
Alternate Key
CNIC
RegistrationNumber
EmailAddress
FullName, CourseID
Foreign Key CourseID
Cardinality 3
Degree 8
SALARY
Attributes:
1. SalaryID
2. EmployeeID
3. SalaryMonth
4. SalaryYear
5. BasicSalary
6. Allowances
7. Deductions
8. TotalPayable
SalaryID EmployeeID SalaryMonth SalaryYear BasicSalary Allowances Deductions TotalPayable
1 1 JANUARY 2015 25000 5000 2000 28000
2 2 JANUARY 2015 26000 5000 2500 28500
3 3 JANUARY 2015 25000 4000 2000 27000
4 1 FEBURARY 2015 25000 5500 2000 28500
5 2 FEBURARY 2015 26000 5500 2500 29000
6 3 FEBURARY 2015 25000 4400 2000 27400
`
Super Key SalaryID
SalaryID, EmployeeID
SalaryID, EmployeeID, SalaryMonth
SalaryID, EmployeeID, SalaryMonth, SalaryYear
SalaryID, EmployeeID, SalaryMonth, SalaryYear, BasicSalary
SalaryID, EmployeeID, SalaryMonth, SalaryYear, BasicSalary, Allowances
SalaryID, EmployeeID, SalaryMonth, SalaryYear, BasicSalary, Allowances, Deductions
SalaryID, EmployeeID, SalaryMonth, SalaryYear, BasicSalary, Allowances, Deductions, TotalPayable
EmployeeID, SalaryMonth, SalaryYear
Candidate Key SalaryID
EmployeeID, SalaryMonth, SalaryYear
Primary Key SalaryID
Alternate Key EmployeeID, SalaryMonth, SalaryYear
Foreign Key EmployeeID
Cardinality 6
Degree 8
These are the key Relation in any University Database. It can be further enhanced by including the
detailed relations like StudentCourse, StudentClass, FacultyCourse, FacultyClass, Admission, Result etc.