0% found this document useful (0 votes)
188 views

Assignment 2 SH

The document describes a database with tables for Students, Courses, Sections, Grade Reports, and Prerequisites. It includes sample queries and updates on the database. It then discusses data redundancy and the disadvantages of redundancy. Some advantages of database management systems are listed as flexibility, fast response to requests, multiple access methods, lower training costs, and reduced storage. The document analyzes the relationships between tables in the database and provides examples of entity and referential integrity constraints that should be enforced.

Uploaded by

sulemanmirza
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
188 views

Assignment 2 SH

The document describes a database with tables for Students, Courses, Sections, Grade Reports, and Prerequisites. It includes sample queries and updates on the database. It then discusses data redundancy and the disadvantages of redundancy. Some advantages of database management systems are listed as flexibility, fast response to requests, multiple access methods, lower training costs, and reduced storage. The document analyzes the relationships between tables in the database and provides examples of entity and referential integrity constraints that should be enforced.

Uploaded by

sulemanmirza
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Class Assignment Assignment # 2

STUDENT

Name Student_number Class Major


Smith 17 1 CS
Brown 8 2 CS
COURSE
Course_name Course_number Credit_hours Department
Intro to computer CS1310 4 CS
Data Structures CS3320 4 CS
Discrete Maths MATH2410 3 MATH
Database CS3380 3 CS
SECTION
Section_identifier Course_number Semeste Year Instructor
r
85 MATH2410 Fall 04 King
92 CS1310 Fall 04 Anderson
102 CS3320 Spring 05 Knuth
112 MATH2410 Fall 05 Chang
119 CS1310 Fall 05 Anderson
135 CS3380 Fall 05 Stone
GRADE_REPORT
Student_number Section_identifier Grade
17 112 B
17 119 C
8 85 A
8 92 A
PREREQUISITE
Course_number Prerequisite_number
CS3380 CS3320
CS3380 MATH2410
CS3320 CS1310

RRelational Database Management 2009-CE-096 1


Class Assignment Assignment # 2

Q1. Identify some informal queries and update operations that


you would expect to apply to the database shown below.

Select:-

1. Select * from STUDENT where name=’Smith’ and student_number >10


2. Select course_number , instructor from SECTION where semester=fall
3. Select * from GRADE_REPORT where Student_number between 5 and 20
4. Select student.student number . student.Name ,Grade_report. From
STUDENT,GRADE_REPORT where student.student

Update:-
1. Update STUDENT as set name=’Smith’
2. Update SECTION as set instructor =’Stone’ and semester=’fall’

Q2. What is data redundancy? What are the disadvantages of


having redundancy within a database?

Data Redundancy:-
Data redundancy is a data organization issue that allows the unnecessary duplication of
data within your Microsoft Access database. A change or modification, to redundant data,
requires that you make changes to multiple fields of a database. While this is the expected
behaviour for flat file database designs and spreadsheets, it defeats the purpose of
relational database designs. 

Essentially, the introduction of redundancy is a function of the size of the redundant column
and the frequency with which the column is updated. The ideal candidates for redundant
duplication are table columns that meet the following criteria:
 
 The introduction of redundancy will eliminate the need to repeatedly join two tables
together.
 The data column is small.
 The data column is static and rarely updated.

RRelational Database Management 2009-CE-096 2


Class Assignment Assignment # 2

Q3. State 5 advantages of DBMS?

Benefits of DBMS (Database Management Systems) are followings:


A true DBMS offers several advantages over file processing. The principal advantages
of a DBMS are the followings:

• Flexibility: Because programs and data are independent, programs do not have
to be modified when types of unrelated data are added to or deleted from the
database, or when physical storage changes.

• Fast response to information requests: Because data are integrated into a


single database, complex requests can be handled much more rapidly then if the
data were located in separate, non-integrated files. In many businesses, faster
response means better customer service. 

• Multiple access: Database software allows data to be accessed in a variety of


ways (such as through various key fields) and often, by using several programming
languages (both 3GL and nonprocedural 4GL programs).

• Lower user training costs: Users often find it easier to learn such systems and
training costs may be reduced. Also, the total time taken to process requests may be
shorter, which would increase user productivity.

• Less storage: Theoretically, all occurrences of data items need be stored only


once, thereby eliminating the storage of redundant data. System developers and
database designers often use data normalization to minimize data redundancy.

Q4. Name all relationships shown in the above database.

Table 1 (STUDENT):-
1. Primary key of this table is Student Number.
2. Name, Class , Major combined can be a candidate key.

Table 2 (COURSE):-
1. Primary key is Course_number.
2. Course_name , credit_ hours, department combined can be a candidate key.

RRelational Database Management 2009-CE-096 3


Class Assignment Assignment # 2

3. Department is a Foreign key from table 1.

Table 3 (SECTION):-
1. Section_identifier is a primary key.
2. Course_number is a foreign key table 2.

Table 4 (GRADE_REPORT):-
1. Student_number, section_identifier , Grade combined can be primary key.
2. Student_number, Section_identifier are foreign keys from table4 and table 3
respectively.

Table 5 (PREREQUISITE):-
1. Course_number and Prerequisite_number combined can be a Primary key.
2. Course_number is a foreign key from table 2.

Q5. Give some examples of integrity constraints that you think


should hold on the database shown above.

Entity integrity:-
The entity integrity constraint states that no primary key value can be null. This is because
the primary key value is used to identify individual tuples in a relation. Having null value for
the primary key implies that we cannot identify some tuples. This also specifies that there
may not be any duplicate entries in primary key column.
Example:-
In every above table field of PK is unique and cannot be null.

Referential Integrity:-
The referential integrity constraint is specified between two relation and is used to maintain
the consistency among tuples in the two relations. Informally, the referential integrity
constraint states that a tuple in one relation that refers to another relation must refer to an
existing tuple in that relation.
Example:-

Every FK defined in question 4, must be the Primary key of the referred table but
foreign key can be partially null.

RRelational Database Management 2009-CE-096 4


Class Assignment Assignment # 2

RRelational Database Management 2009-CE-096 5

You might also like