Assignment on Dbms

9
ASSIGNMENT ON DBMS SUBMITTED TO- SUBMITTED BY- MR.AMANDEEP GAURAV KAKKAR MCA E3804-A23 10804670

Transcript of Assignment on Dbms

ASSIGNMENT

ON

DBMS

SUBMITTED TO- SUBMITTED BY-

MR.AMANDEEP GAURAV KAKKAR

MCA

E3804-A23

10804670

Q1:-> Explain the distinctions among the terms with the help of an example:

(a)Primary key, candidate key and super key

(b) strong and weak entity

(a)Primary key, candidate key and super key:

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

EXAMPLE: CREATE TABLE Employees (empID integer, 1Name varchar(30), Name2 varchar(30), PRIMARY KEY (empID));

The combination of attributes is the candidate key. It is used to identify a database record.there may be many candidate keys in one table.

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.

In our example table, possible superkeys are:{employeeID}{employeeID,employeeName}{employeeID, employeeName, address}

A super key is a key that uniquely identifies rows in a table. Any of the identified candidate keys can be used as the table's primary key..

(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 special value NULL. it is valid in any column.when a valid entry for a field is not known or not applicable then it is used.

A NULL value would be the proper value. For a wedding_anniversary column, unmarried people would have aNULL value in that field. NULL values are very useful. Before databases supported NULL values, users would put special values in columns, such as -1 for unknown numbers and 1/1/1900 for unknown dates. NULL values offer a more consistent way to mark such values.

Q3:->Consider the following set of requirements for a university database that is used to

keep track of students transcripts:-

(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.

(a). create table stddata ( name char(20),std no varchar(10), current address varchar(25), phone number(10), DOB number(10), sex char(6), class varchar(8), major dept varchar(8), minor dept varchar(6), zip code number(6);

(b) create table dept (deptname char(6) unique,code varchar(8) unique, , office no number(7), office phone number(11), college char(10);

( c ) create table course(coursename char(10) , description char(30), course no number(8), semester hours number(2), level (2));

Part B

Q1:-> Describe the ACID properties of transaction. Discuss its impact on the transaction with the help of example?

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.

Q2:->Since every conflict –serializable schedule is view serializable, why do we emphasize conflict serializability rather than view serializability?

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.

Q3:-> Illustrate the Locking Concept of concurrency control used for maintaining the consistency in the database.

Ans.. for sharing data we use the concurrency control and locking concept. If we wantto 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 exexution 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.