ER Model Test
ER Model Test
Institution
Specialization Cr_Hr
N Offers N
TlName TEACHER COURSE
1 1 N Date_employed N
N
TidNo
Works Has
TSex Year
Manage
Depn_relationship
D_Head
1 1 1 Semester
TDOB Takes
DEPARTMENT D_Name Depn_Name
Grade
1
D_Location
Register
Has
D_Number N DEPENDANT
N
STUDENT SMName
SName
SLName
SIDNum
SSex
1. Assume that you are working for ABC Collage as Database Administrator.
ABC Collage needs to store the information of its Student, having (Stud ID, FirstName,
LastName, Age) taking a Course (Coursecode, CourseName, Cradit hrs) in different
Department with (DeptID, DeptName, officeNo).
Case1: Many students can take many courses and many courses can be taken by many
students
Case2: A student can have enrolled at one Department at a time and a department can have
many students
Case3: Course is given by a single department while a department can have many courses
2. Assume that you are working for ABC company as Database Administrator. The
company is organized into department. Each department has unique deptid, deptname
and several locations. A department controls a number of project. Each project has a
unique Pno, name and is located at a single location. We store each employee’s
unique Eno, name, salary, sex, and birthdates. Many employee works for one
department and may work on several projects.
Based on the above scenario Assess the business requirement of the prescriptions and
perform the following task by using Microsoft office vision 2007 or edraw max 2007
software
1. Identify the database Entities of the organization
2. Identify a type of Attributes for each entity
3. Draw entity relationship (ER) diagram for the identified entities with type of
Attributes
START
READ
SAL,
YEAR
Bonus= SAL*.1
Yes
YEAR> Bonus= Bonus+100
=10
No
dsfadfdaffgsgfsgfggff
WRITE
BONU
S
Read NAME,
BALANCE, RATE
Interest=BALANCE *RATE
3) A program that identifies a larger and smaller number from two numbers
Start
Read A, B
Yes Big=B
A<B?
Small=A
No
Big=A
Small=B
Stop
4) Calculate grade for ten students based on the scale:
>80-A Start
>60-B
>50-C
Count=1 >40-D
<40-F
Yes
MARK>80 ? GRADE-A
No
Yes GRADE-B
MARK>60 ?
No
Yes GRADE-C
MARK>50 ?
No
Yes GRADE-D
MARK>40 ?
No
GRADE-F
Increment Count
Pseudo-code:
It is much similar to real code. We use verbs to write pseudo-code. Capitalize important words that show actions.
Eg 1) A pseudo-code to calculate interest rate
ACCEPT Name, Principal, Rate
Interest=Principal X Rate
DISPLAY Name, Interest
2) A pseudo-code to calculate bonus
ACCEPT Name, Salary
Bonus=SalaryX0.1
ACCEPT Serviceyear
IF Serviceyear>10 Then
Bonus+100
ENDIF
DISPLAY Bonus
3) A pseudo-code that calculates grade
ACCEPT Mark, Name
IF Mark>80 Then
GradeA
ELSE IF Mark>=70 Then
GradeB
ELSE IF Mark>=60 Then
GradeC
ELSE IF Mark>=50 Then
GradeD
ELSE
GradeF
ENDIF
DISPLAY Grade, Name
Solution 5
Check here: http://sqlwithmanoj.com/2014/09/15/db-basics-what-are-candidate-primary-composite-super-keys-and-difference-between-
them/[^]
1. Candidate Key: are individual columns in a table that qualifies for uniqueness of all the rows. Here in Employee table EmployeeID &
SSN are Candidate keys.
2. Primary Key: is the columns you choose to maintain uniqueness in a table. Here in Employee table you can choose either EmployeeID or
SSN columns, EmployeeID is preferable choice, as SSN is a secure value.
3. Alternate Key: Candidate column other the Primary column, like if EmployeeID is PK then SSN would be the Alternate key.
4. Super Key: If you add any other column/attribute to a Primary Key then it become a super key, like EmployeeID + FullName is a Super
Key.
5. Composite Key: If a table do have a single columns that qualifies for a Candidate key, then you have to select 2 or more columns to make
a row unique. Like if there is no EmployeeID or SSN columns, then you can make FullName + DateOfBirth as Composite primary Key. But
still there can be a narrow chance of duplicate row.