Homework No:3: CAP301: Database Management System
Homework No:3: CAP301: Database Management System
Homework No:3: CAP301: Database Management System
I declare that this assignment is my individual work. I have not copied from any other
student’s work or from any other source except where due acknowledgment is made
explicitly in the text, nor has any part been written for me by another person.
Student’s Signature
Evaluator’s comments:
_____________________________________________________________________
Primary key : Primary Key is the key that is used to uniquely identify each row.
In table if the primary key is used then the column is unique. Primary key may be
he part of the original reports.. there may be many fields in the primary keys.if
there are many records that are using the primary key then it is called composite
SQL primary key.
we can specify the primary key either when the table is created or and we can
change the structure
A super key is a column or set of columns that uniquely identifies a row within a
table. Super key can identify the the rows.
(B).. Strong Entity: we can identify the objects by their attributes and a subset
of these attributes forms a primary key for uniquely identified an instance of an
entity. Entity types that have primary keys are called strong entities.
Weak Entity: instance of weak entity sets associated with the same instance of the
strong entity must be distinguishable from each other by a subset of the attributes
of the weak entity.
Q2:-> List the various cases where use of null value would be appropriate?
(a) The university keeps track of each student’s name, student no, current
address and phone, DOB , sex, class (first year, second year
,...graduate),major dept, minor dept (if any) and zip code of the
student’s permanent address to the student last name.. both personal
number and student no have unique values for each student.
(b) Each dept is described by name, dept code, office no, office phone, and
college. Both name and code have unique values for each dept.
(c) Each course has a course name , description, course no, number of
semester hours, level and offering dept. The value of the course is
unique for each course.
(d) Each section has an instructor , semester, year, course and section no.
The section no distinguishes sections of the same course that are taught
during the same semester/year. its values are1,2,3...up to the number of
sections taught during each semester
(e) A grade report has a student, section, letter grade and numeric
grade(0,1,2,3 or 4)
Design an ER schema for this application and draw ER diagram for that
schema. Specify key attributes of each entity type and structural
constraints on each relationship type and make appropriate assumptions to
complete it.
Ans.
(b) create table dept (deptname char(6) unique,code varchar(8) unique, , office no
number(7), office phone number(11), college char(10);
Ans. Atomicity
As if they are a single operation all data changes are performed. That is, all
the changes are performed, or may be none. If we transfer the amount from
one to another account then it goes successfully.
Consistency
Consistency is the data state in which the process starts and ends is shown.
At the time of transfer the data processing in both account are same.
Isolation
The intermediate state of a transaction is invisible to other transactions. As a
result, transactions that run concurrently appear to be serialized.
Durability
After a transaction successfully completes, changes to data persist and are
not undone, even in the event of a system failure. When the data is not
effected with the process then it is called durability.
Ans . it means the transaction is the same to the both side. The transactions are in
the two schedules .. these are the read and the write. These should be the same to
the both side.
The serial schedual should be equal. It should be the same to the both side. Both
the side should have the same pairs of conflicting operation. It is called the
conflict serializability.
Because conflict-seriliazability needs in simple algorithms for its checking, while
checking of view-seriliazability belongs to NP-complete problems.
Ans.
1. Binary locking
For sharing data we use the concurrency control and locking concept. If we want
to get Atomicity, consistency, and isolation are achieved then we have to use
concurrency control and locking..
If at the same time many people are doing the same work on same account then if I
am working then all are locked to do job on the same work or execute. The
execution is possible on one system then it is called the locking for others. Locking
is the way to secure the another data when we are working on one data.
For example: -
T1:=lock(a);
Read(a);
A:=a+70;
Write(a);
Unlock(a);