q1 - wordpress.com€¦  · web viewq1 answer the following question. 14 1 different between...

19
Q1 Answer the following question. 1 4 1 Different between “instance” and “schema”. Ans : Instance: The information in a database at a particular point in time is called Instance. Schema:- is the logical structure of the database There are two types of Schema. Physical schema Logical schema 2 What is Multivalued dependency? Ans : Multivalued dependency Given relation schema R let X and Y be subset of attribute of R then Dependency Multivalued X⇒Y holds in a relation R define on R. If you given Tupples t1 and t2 in R with t1(x)=t2(x) R contains two tuples t3 and t4 with The following characteristics t1, t2, t3, t4 have the same X value EX: t1(x)=t2(x)=t3(x)=t4(x) Then Y values of t3 are the same and y value of t2 and t3 are same. T1(y)=t3(y) and t2(y)=t4(y). 3 What is weak entity set? Ans : Entity set:- An entity set may not have sufficient attributes form a primary key. Such an entity set is turned a weak entity set. Denoted by: 4 State difference between delete and drop. Ans : Delete: The delete command removes Tupples from a relation. It includes a WHERE clause, similar to that used in SQL query, to select Tupples to be deleted. Drop: The drop command can be used to drop named schema elements, such as tables, domains, constraints. One can also drop a schema. 5 List out rules derived from Armstrong’s axiom. Ans : Reflexivity Augmentation Transitivity

Upload: others

Post on 30-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

Q1 Answer the following question. 14

1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular point in time is called

Instance.Schema:- is the logical structure of the databaseThere are two types of Schema. Physical schema Logical schema

2 What is Multivalued dependency?Ans: Multivalued dependency

Given relation schema R let X and Y be subset of attribute of R then Dependency Multivalued X⇒Y holds in a relation R define on R. If you givenTupples t1 and t2 in R with t1(x)=t2(x) R contains two tuples t3 and t4 withThe following characteristics t1, t2, t3, t4 have the same X valueEX: t1(x)=t2(x)=t3(x)=t4(x)Then Y values of t3 are the same and y value of t2 and t3 are same. T1(y)=t3(y) and t2(y)=t4(y).

3 What is weak entity set?Ans: Entity set:-

An entity set may not have sufficient attributes form a primary key. Such an entity set is turned a weak entity set.

Denoted by:

4 State difference between delete and drop.Ans: Delete:

The delete command removes Tupples from a relation. It includes a WHERE clause, similar to that used in SQL query, to select Tupples to be deleted.

Drop: The drop command can be used to drop named schema elements, such as tables, domains, constraints. One can also drop a schema.

5 List out rules derived from Armstrong’s axiom.Ans: Reflexivity

Augmentation Transitivity Self-determination Decomposition Union Composition Pseudo transitivity

6 Differentiate between parital key and primary key.Ans: Primary key: A Candidate Key that is used by the database designer

For unique identification of each row in a table is known As a primary key. A Primary Key can consist of one or more attributes of a table.A primary key is a column (or columns) in a table that uniquely. identifies the rows in that table.

CUSTOMERS

Page 2: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

CustomerNo FirstName LastName

1 Sally Thompson

2 Sally Henderson

3 Harry Henderson

E.g. of Primary Key - Database designer can use one of the Candidate key as a primary key. In this case we have “Code” and “Name, Address” ” as Candidate Key, combination of more than one attribute

7 What is differeance between physical and logical independence?Ans: Physical independence: PDI is the ability to modify the physical schema

Without causing application programs to be rewritten. Modification at the physical level is oscationly improve performances.

Logical independence: lDI is the ability to modify the physical schema Without causing application programs to be rewritten.

Modification at the logical level whenever logical structure of Database is alter.

8 What is referential integrity? How you can achieve it?Ans: Referential integrity: Referential integrity preserves the defined SQL

relationships between tables when rows are entered or deleted. In Server, referential integrity is based on relationships between foreign keys and primary keys. or between foreign keys and unique keys throws FOREIGN KEY and CHECK constraints. Referential integrity makes sure that key values are consistent across tables. These types consistency requires that there are to non existent no references values and that if a key value changes all references to it change consistently throughout the database.

Q2 Answer the following question. (any three )(a) Er diagram for student information.Ans Er diagram:

Rectangles represent entity sets. Diamonds represent relationship sets. Lines link attributes to entity sets and entity sets to relationship sets.

Page 3: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

Ellipses represent attributes Double ellipses represent multivalued attributes. Dashed ellipses denote derived attributes. Underline indicates primary key attributes (will study later)

Customer er diagram

Entity sets of a relationship need not be distinct The labels “manager” and “worker” are called roles; they specify how employee entities interact via the works-for relationship set.Roles are indicated in E-R diagrams by labelling the lines that connect diamonds to rectangles.Role labels are optional, and are used to clarify semantics of the relationship

(B) What is DBA ? Explain the responsibilities of DBA?

ans DBA: A Database administrator is a person for design implication maintains

and repair of an organization database .OR

Database Administrator is having person central over data and producing Accessing that data

Responsibility of DBA Insolation of New software:- It is job the DBA to install new version of Dbms software other software

Application software other software related to Dbms Administrator . It is imporant that DBA or other Informmation system(Is) stuff member

test new software before it is moved into a production environment. Security Administator :- one of main Duties of the DBA is to monitor and administator of DBMS security. This involved adding and remove user administator force and checking

for security problem. Data analysist:- The data analysist data stored in Database and make recommndation

relating to perform effiency

Std_id S_name

Std_street student

S_city

Page 4: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

to data storage. DataBase Design : The DataBase Administator can be invloved at the DataBase design

stage ,elimating any problem that might occur. confusion of hardware and software with :- The system software can be only be access by the system administrator. Data Modular and optimization By moulding the data a system layout to take advantage of subsystem. Recovery and Backup:- It is one most important and vital duties OF A Database Administrator.

Any type of error such as data entry error ,software error, hardware error, etc. An result

(C) What is the purpose of normalization? Write a note on BCNF.

Ans Normalization purpose

Normalization can be viewed as a series of steps designed, one after another, to deal with ways in which tables can be “too complicated  for their own good”. the purpose of normalization is to reduce the chances for anomalies to occur in a database.

The definitions of the various levels of normalization illustrate complications to be eliminated in order to reduce the chances of anomalies. The process of normalization is a formal method that identifies relations based on their primary or candidate keys and the functional dependencies among their attributes

Normalization is a technique for producing a set of relations with desirable properties, given the data requirements of an enterprise.

The process of normalization is a formal method that identifies relations based on their primary or candidate keys and the functional dependencies among their attributes.

Normalization is a technique that Decomposes data into two dimensional tables. Eliminates any relationships in which table data does fully depend upon

the primary key of a record. Eliminates any relationship that contains transitive dependencies.

Forms of normalization :- 1 1NF [First Normal Form] 2NF [Second Normal Form] 3NF [third Normal Form] 4 4NF [Fourth Normal Form] BCNF[Boyce codd Normal Form]

Boyce-Codd Normal Form (BCNF)Rules:-

Isolate indepent multiple relation ship. Table

Page 5: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

May contain two or more one to many Many to many relation ship that are not directly. A relation is in BCNF, if and only if, every determinant is a Candidate key. The difference between 3NF and BCNF is that for a functional dependency A à B, 3NF allows this dependency in a relation if B is a primary-key attribute and A is not a candidate key, whereas BCNF insists that for this dependency to remain in a relation, A must be a candidate key.

Q-3 Answer the following(A) Differentiate between generalization and specialization, explain

generalization with example.

Ans.Generalization and Specialization

Extending the entity set account by classifying accounts as being either savings-account or chequing-account.

Figure :

Each of these is described by the attributes of account plus additional attributes. (savings has interest-rate and chequing has overdraft-amount.)

We can express the similarities between the entity sets by generalization. This is the process of forming containment relationships between a higher-level entity set and one or more lower-level entity sets. In E-R diagrams, generalization is shown by a triangle, as shown in Figure.

Generalization hides divergences and emphasizes similarities. Distinction made through attribute inheritance.

Attributes of higher-level entity are inherited by lower-level entities.

Two methods for conversion to a table form: _ Create a table for the high-level entity, plus tables for the lower-level entities containing also their specific attributes.

Page 6: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

_ Create only tables for the lower-level entities.

Specialization: An entity set may include sub groupings of entities that are distinct in

some way from other entities in entity set. For instance, a subset of entities within an entity set may have attributes

that are not shared by all the entities in the entity set. The e-r model provides a means for representing these distinctive entity grouping.

Each of this person type is described by a set of attributes that includes all the attributes of entity set person plus possibly additional attributes.

For example, customer entities may be described further by the attribute credit rating, whereas employee entities may be described further by the attribute salary. The process of designating sub groupings within an entity set is called specialization.

(B) Explain file processing system. Explain three major disadvantage of this system.

Ans. Processing system

A File can store records and we can extract these records using different applications programs.

The simplest data retrieval task from file requires extensive programming. Also this is a time consuming and a high skill activity.

To access the data in file the programmer must aware of the physical structure of the file.

Security features such as effective password protection, locking parts of file etc are very difficult to program.

The File system exhibits structural dependence. That is a change in file structure such as addition or deletion of a field requires the modification of all programs using that file.

Data dependence: A change in file data characteristic such as change in a field data type from integer to decimal requires changes in all programs that access the file.

Page 7: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

A typical file processing system is supported by conventional operating systems. The system stores permanent record in various files. It uses various application programs to extract records from, and add records to the appropriate files. Before using DBMS to store and retrieve data, organizations stored information in file processing systems.

But as the number of files in the system expands, system administration becomes difficult too. Each file must have its own file management system, composed of programs that allow user to create the file structure, add data to the file, delete data from the file, modify the data in the file, list the file contents etc. Disadvantages of File Processing Systems include: 

1. Program-Data Dependence. File descriptions are stored within each application program that accesses a given file. 

2. Duplication of Data.  Applications are developed independently in file processing systems leading to unplanned duplicate files. Duplication is wasteful as it requires additional storage space and changes in one file must be made manually in all files. This also results in loss of data integrity. It is also possible that the same data item may have different names in different files, or the same name may be used for different data items in different files. 

3. Limited data sharing. Each application has its own private files with little opportunity to share data outside their own applications. A requested report may require data from several incompatible files in separate systems. 

4. Lengthy Development Times. There is little opportunity to leverage previous development efforts. Each new application requires the developer to  start from scratch by designing new file formats and descriptions   

5. Excessive Program Maintenance. The preceding factors create a heavy program maintenance load.

(c) What is purpose of mapping cardinality? Explain with example.Ands

Express the number of entities to which another entity can be associated via a relationship set.

Most useful in describing binary relationship sets.

For a binary relationship set the mapping cardinality must be one of the following types:

1.One to one

2.One to many

3.Many to one

4.Many to many

Page 8: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

One to one One to many

Note: Some elements in A and B may not be mapped to any

elements in the other set

Many to one Many to many

Note: Some elements in A and B may not be mapped to any

elements in the other set

Mapping Cardinalities affect ER Design

Can make access-date an attribute of account, instead of a relationship attribute, if each account can have only one customer

I.e., the relationship from account to customer is many to one, or equivalently, customer to account is one too many.

Page 9: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

E-R Diagrams

Rectangles represent entity sets.

Diamonds represent relationship sets.

Lines link attributes to entity sets and entity sets to relationship sets.

Ellipses represent attributes

Double ellipses represent multivalve attributes.

Dashed ellipses denote derived attributes.

Underline indicates primary key attributes (will study later)

E-R Diagram With Composite, Multivolume, and Derived Attributes

Page 10: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

Relationship Sets with Attributes

Roles

Entity sets of a relationship need not be distinct

The labels “manager” and “worker” are called roles; they specify how employee entities interact via the works-for relationship set.

Roles are indicated in E-R diagrams by labeling the lines that connect diamonds to rectangles.

Role labels are optional, and are used to clarify semantics of the relationship

Page 11: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

Cardinality Constraints

We express cardinality constraints by drawing either a directed line (®), signifying “one,” or an undirected line (—), signifying “many,” between the relationship set and the entity set.

E.g.: One-to-one relationship:

A customer is associated with at most one loan via the relationship borrower

A loan is associated with at most one customer via borrower

One-To-Many Relationship

In the one-to-many relationship a loan is associated with at most one customer via borrower, a customer is associated with several (including 0) loans via borrower

Page 12: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

Many-To-One Relationships

In a many-to-one relationship a loan is associated with several (including 0) customers via borrower, a customer is associated with at most one loan via borrower

Many-To-Many Relationship

A customer is associated with several (possibly 0) loans via borrower

A loan is associated with several (possibly 0) customers via borrower

Q-4 Answer the following question(A) Write a note on various types of attributesAnds

An entity is represented by a set of attributes that is descriptive properties possessed by all members of an entity set.Domain – the set of permitted values for each attribute Attribute types:Simple and composite attributes.Single-valued and multi-valued attributesE.g. multivolume attribute: phone-numbersDerived attributesCan be computed from other attributesE.g. age, given date of birthExample:

customer = (customer-id, customer-name, customer-street, customer-city)

loan = (loan-number, amount)

Simple and Composite Attribute

Page 13: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

Simple attribute that consist of a single atomic value. A composite attribute is an attribute that can be further subdivided. For example the attribute ADDRESS can be subdivided into street, city, state, and zip code. A simple attribute cannot be subdivided. For example the attributes age, sex etc is simple attributes.

Simple Attribute: Attribute that consist of a single atomic value.Example: Salary, age etc

Composite Attribute: Attribute value not atomic.Example :   Address  :  ‘House_no:City:State                  Name      :  ‘First Name: Middle Name: Last Name’

Single Valued and Multi Valued attribute

A single valued attribute can have only a single value. For example a person can have only one 'date of birth', 'age' etc. That is a single valued attributes can have only single value. But it can be simple or composite attribute. That is 'date of birth' is a composite attribute, 'age' is a simple attribute. But both are single valued attributes.

Multivolume attributes can have multiple values. For instance a person may have multiple phone numbers, multiple degrees etc.Multivalued attributes are shown by a double line connecting to the entity in the ER diagram.

Single Valued Attribute: Attribute that hold a single valueExample1: AgeExampe2: CityExample3:Customer id

Multi Valued Attribute: Attribute that hold multiple values.Example1: A customer can have multiple phone numbers, email id's etcExample2: A person may have several college degrees

Stored and Derived Attributes

The value for the derived attribute is derived from the stored attribute. For example 'Date of birth' of a person is a stored attribute. The value for the attribute 'AGE' can be derived by subtracting the 'Date of Birth'(DOB) from the current date. Stored attribute supplies a value to the related attribute.

Stored Attribute: An attribute that supplies a value to the related attribute.Example: Date of Birth

Derived Attribute: An attribute that’s value is derived from a stored attribute.Example: Age and its value are derived from the stored attribute Date of Birth.

Complex Attribute

A complex attribute that is both composite and multi valued

(C)Write a note on strong entity set

Page 14: Q1 - WordPress.com€¦  · Web viewQ1 Answer the following question. 14 1 Different between “instance” and “schema”.Ans: Instance: The information in a database at a particular

Ands

An entity set that does not possess sufficient attributes to form a primary key is called a weak entity set. One that does have a primary key is called a strong entity set.

The discriminator (or partial key) of a weak entity set is the set of attributes that distinguishes among all the entities of a weak entity set

The existence of a weak entity set depends on the existence of a identifying entity set. It must relate to the identifying entity set via a total, one-to-many relationship set from the identifying to the weak entity set

We depict a weak entity set by double rectangles in E-R diagram. We underline the discriminator of a weak entity set with a dashed line in E-R diagram.

Weak Entity SetsAn entity set that does not have a primary key is referred to as a weak entity set.The existence of a weak entity set depends on the existence of a identifying entity set

it must relate to the identifying entity set via a total, one-to-many relationship set from the identifying to the weak entity setIdentifying relationship depicted using a double diamond

The discriminator (or partial key) of a weak entity set is the set of attributes that distinguishes among all the entities of a weak entity set.The primary key of a weak entity set is formed by the primary key of the strong entity set on which the weak entity set is existence dependent, plus the weak entity set’s discriminator.We depict a weak entity set by double rectangles.We underline the discriminator of a weak entity set with a dashed line.payment-number – discriminator of the payment entity set

Primary key for payment – (loan-number, payment-number

Q-5 Considered following relation.Ans Player(Pid,Name,Type)

Bowling (Pid, no,overno, ball no, Run)A. Consider above table and decided their normal form.

Try convert it into 4th normal formal(if possible)B. Using above table solved following queries.

1 create pad as forge in key in bowling relation. 2 Display total number of Balls deliver and by ‘Irfan’ 3 Display balls in descending order or run. 4 Display the total bastman available in player table. 5 Display the name of player whose name’s second letter is ‘a’ and name length is 10