Anda di halaman 1dari 9

July 2011 Master of Computer Science (MSCCS) Semester 1 MC0067 Database Management System (DBMS and Oracle 9i)

i) 4 Credits (Book ID: B0716 & B0717) Assignment Set 2 (40 Marks)
Answer all Questions Q.1) Each Question Carries ten Marks Book ID: B0716 Explain the purpose of Data Modeling. What are the basic constructs of E-R Diagrams? Answer: 1 Data modeling in is the process of creating a data model by applying formal data model descriptions using data modeling techniques. Data modeling is the act of exploring data-oriented structures. Like other modeling artifacts data models can be used for a variety of purposes, from high-level conceptual models to physical data models. Data modeling is the formalization and documentation of existing processes and events that occur during application software design and development. Data modeling techniques and tools capture and translate complex system designs into easily understood representations of the data flows and processes, creating a blueprint for construction and/or re-engineering. Basic Constructs of E-R Modeling: The ER model views the real world as a construct of entities and association between entities. The basic constructs of ER modeling are entities, attributes, and relationships. Entity: Entities are the principal data object about which information is to be maintained. An entity may be defined as a thing which is recognized as being capable of an independent existence and which can be uniquely identified. An entity is an abstraction from the complexities of some domain. When we speak of an entity we normally speak of some aspect of the real world which can be distinguished from other aspects of the real world. An entity may be a physical object such as a house or a car, an event such as a house sale or a car service, or a concept such as a customer transaction or order. Although the term entity is the one most commonly used, following Chen we should really distinguish between an entity and an entity-type. An entity-type is a category. An entity, strictly speaking, is an instance of a given entity-type. There are usually many instances of an entitytype. Because the term entity-type is somewhat cumbersome, most people tend to use the term entity as a synonym for this term. Entities can be thought of as nouns. Examples: a computer, an employee, a song, a mathematical theorem. Special Entity Types Associative entities (also known as intersection entities) are entities used to associate two or more entities in order to reconcile a many-to-many relationship. Subtypes entities are used in generalization hierarchies to represent a subset of instances of their parent entity, called the super type, but which have attributes or relationships that apply only to the subset. Relationship:

Page 1 of 9

Roll No. 521126647

July 2011 Master of Computer Science (MSCCS) Semester 1 MC0067 Database Management System (DBMS and Oracle 9i) 4 Credits (Book ID: B0716 & B0717) Assignment Set 2 (40 Marks)
A relationship captures how two or more entities are related to one another. Relationships can be thought of as verbs, linking two or more nouns. Examples: an owns relationship between a company and a computer, a supervises relationship between an employee and a department, a performs relationship between an artist and a song, a proved relationship between a mathematician and a theorem. Attributes: Attributes describe the entity of which they are associated; a particular instance of an attribute is a value. Entities and relationships can both have attributes. The domain of an attribute is the collection of all possible values for that attribute. Attributes can be classified as identifiers or descriptors. Examples: an employee entity might have a Social Security Number (SSN) attribute; the proved relationship may have a date attribute. Q.2) Write about: a. Types of Discretionary Privileges b. Propagation of Privileges using Grant Option c. Physical Storage Structure of DBMS d. Indexing

Answer: 2 (a) Types of Discretionary Privileges:


The concept of an authorization identifier is used to refer, to a user account. The DBMS must provide selective access to each relation in the database based on specific accounts. There are two levels for assigning privileges to use the database system:

The account level: At this level, the DBA specifies the particular privileges that each account holds
independently of the relations in the database.

The relation (or table level): At this level, the DBA can control the privilege to access each individual
relation or view in the database. The privileges at the account level apply to the capabilities provided to the account itself and can include the CREATE SCHEMA or CREATE TABLE privilege, to create a schema or base relation; the CREATE VIEW privilege; the ALTER privilege, to apply schema changes such adding or removing attributes from relations; the DROP privilege, to delete relations or views; the MODIFY privilege, to insert, delete, or update tuples; and the SELECT privilege, to retrieve information from the database by using a SELECT query. The second level of privileges applies to the relation level, whether they are base relations or virtual (view) relations. The granting and revoking of privileges generally follow an authorization model for discretionary privileges known as the access matrix model, where the rows of a matrix M represents subjects (users, accounts,

Page 2 of 9

Roll No. 521126647

July 2011 Master of Computer Science (MSCCS) Semester 1 MC0067 Database Management System (DBMS and Oracle 9i) 4 Credits (Book ID: B0716 & B0717) Assignment Set 2 (40 Marks)
programs) and the columns represent objects (relations, records, columns, views, operations). Each position M(i,j) in the matrix represents the types of privileges (read, write, update) that subject i holds on object j. To control the granting and revoking of relation privileges, each relation R in a database is assigned and owner account, which is typically the account that was used when the relation was created in the first place. The owner of a relation is given all privileges on that relation. The owner account holder can pass privileges on R to other users by granting privileges to their accounts. In SQL the following types of privileges can be granted on each individual relation R: SELECT (retrieval or read) privilege on R: Gives the account retrieval privilege. In SQL this gives the account the privilege to use the SELECT statement to retrieve tuples from R. MODIFY privileges on R: This gives the account the capability to modify tuples of R. In SQL this privilege is further divided into UPDATE, DELETE, and INSERT privileges to apply the corresponding SQL command to R. In addition, both the INSERT and UPDATE privileges can specify that only certain attributes can be updated or inserted by the account. REFERENCES privilege on R: This gives the account the capability to reference relation R when specifying integrity constraints. The privilege can also be restricted to specific attributes of R.

Answer: 2 (b) Propagation of Privileges using the GRANT OPTION:


Whenever the owner A of a relation R grants a privilege on R to another account B, privilege can be given to B with or without the GRANT OPTION. If the GRANT OPTION is given, this means that B can also grant that privilege on R to other accounts. Suppose that B is given the GRANT OPTION by A and that B then grants the privilege on R to a third account C, also with GRANT OPTION. In this way, privileges on R can propagate to other accounts without the knowledge of the owner of R. If the owner account A now revokes the privilege granted to B, all the privileges that B propagated based on that privilege should automatically be revoked by the system.

Answer: 2 (c) Physical Storage Structures of DBMS:


The physical design of the database specifies the physical configuration of the database on the storage media. This includes detailed specification of data elements, data types, indexing options and other parameters residing in the DBMS data dictionary. It is the detailed design of a system that includes modules & the database's hardware & software specifications of the system. Physical structures are

Page 3 of 9

Roll No. 521126647

July 2011 Master of Computer Science (MSCCS) Semester 1 MC0067 Database Management System (DBMS and Oracle 9i) 4 Credits (Book ID: B0716 & B0717) Assignment Set 2 (40 Marks)
those that can be seen and operated on from the operating system, such as the physical files that store

data on a disk. Basic Storage Concepts (Hard Disk) disk access time = seek time + rotational delay Disk access times are much slower than access to main memory.

Overriding DBMS performance objective is to minimize the number of disk accesses (disk I/Os)

Answer: 2 (d) Indexing:


Data structure allowing a DBMS to locate particular records more quickly and hence speed up queries.Book index has index term (stored in alphabetic order) with a page number.Database index (on

Page 4 of 9

Roll No. 521126647

July 2011 Master of Computer Science (MSCCS) Semester 1 MC0067 Database Management System (DBMS and Oracle 9i) 4 Credits (Book ID: B0716 & B0717) Assignment Set 2 (40 Marks)
a particular attribute) has attribute value (stored in order) with a memory address.An index gives direct access to a record and prevents having to scan every record sequentially to find the one required.

Using SUPPLIER(Supp# , SName, SCity) Consider the query Get all the suppliers in a certain city ( e.g. London) 2 possible strategies: a. Search the entire supplier file for records with city 'London' b. Create an index on cities, access it for 'London entries and follow the pointer to the corresponding records

SCity Index Dublin London London Paris Paris Book ID: B0717 Q.3)

Supp# S1 S2 S3 S4 S5

SName Smith Jones Brown Clark Ellis

SCity London Paris Paris London Dublin

What is a relationship type? Explain the differences among a relationship instance, a relationship type, and a relationship set. Answer: 3.There are three types of relationships 1) 2) 3) One to one One to many Many to many

Say we have table1 and table2 For one to one relationship, a record (row) in table1 will have at most one matching record or row in table2 I.e. it mustnt have two matching records or no matching records in table2. For one to many, a record in table1 can have more than one record in table2 but not vice versa Lets take an example, Say we have a database which saves information about Guys and whom they are dating. We have two tables in our database Guys and Girls Guy id 1 2 3 Girl id 1 Guy name Andrew Bob Craig Girl name Girl1

Page 5 of 9

Roll No. 521126647

July 2011 Master of Computer Science (MSCCS) Semester 1 MC0067 Database Management System (DBMS and Oracle 9i) 4 Credits (Book ID: B0716 & B0717) Assignment Set 2 (40 Marks)
2 3 Girl2 Girl3

Here in above example Guy ID and Girl ID are primary keys of their respective table. Say Andrew is dating Girl1, Bob Girl2 and Craig is dating Girl3. So we are having a one to one relationship over there. So in this case we need to modify the Girls table to have a Guy id foreign key in it. Girl id Girl name Guy id 1 Girl1 1 2 Girl2 2 3 Girl3 3 Now let say one guy has started dating more than one girl. i.e. Andrew has started dating Girl1 and say a new Girl4 That takes us to one to many relationships from Guys to Girls table. Now to accommodate this change we can modify our Girls table like this Girl Id Girl Name Guy Id 1 Girl1 1 2 Girl2 2 3 Girl3 3 4 Girl4 1 Now say after few days, comes a time where girls have also started dating more than one boy i.e. many to many relationships So the thing to do over here is to add another table which is called Junction Table, Associate Table or linking Table which will contain primary key columns of both girls and guys table. Let see it with an example Guy id Guy name 1 Andrew 2 Bob 3 Craig Girl id Girl name 1 Girl1 2 Girl2 3 Girl3 Andrew is now dating Girl1 and Girl2 and Now Girl3 has started dating Bob and Craig so our junction table will look like this Guy ID Girl ID 1 1 1 2 2 2 2 3 3 3 It will contain primary key of both the Girls and Boys table. A relationship type R among n entity types E1, E2, , En is a set of associations among entities from these types. Actually, R is a set of relationship instances ri where each ri is an n-tuple of entities (e1, e2, , en), and each entity ej in ri is a member of entity type Ej, 1jn. Hence, a relationship type is a mathematical relation on E1, E2, , En, or alternatively it can be defined as a subset of the Cartesian product E1x E2x xEn . Here, entity types E1, E2, , En defines a set of relationship, called relationship sets.

Page 6 of 9

Roll No. 521126647

July 2011 Master of Computer Science (MSCCS) Semester 1 MC0067 Database Management System (DBMS and Oracle 9i) 4 Credits (Book ID: B0716 & B0717) Assignment Set 2 (40 Marks)
Relationship instance: Each relationship instance ri in R is an association of entities, where the association includes exactly one entity from each participating entity type. Each such relationship instance ri represent the fact that the entities participating in ri are related in some way in the corresponding miniworld situation. For example, in relationship type WORKS_FOR associates one EMPLOYEE and DEPARTMENT, which associates each employee with the department for which the employee works. Each relationship instance in the relationship set WORKS_FOR associates one EMPLOYEE and one DEPARTMENT. Q.4) Write about (With an example for each) a. Categories of Data Models b. Schemas, Instances and Database States Answer: 4(a) Categories of Data Models A data model in software engineering is an abstract model that documents and organizes the business data for communication between team members and is used as a plan for developing applications, specifically how data is stored and accessed. A data model explicitly determines the structure of data or structured data. Typical applications of data models include database models, design of information systems, and enabling exchange of data. Usually data models are specified in a data modeling language. A database model is a theory or specification describing how a database is structured and used. Several such models have been suggested. Common models include: Flat model: This may not strictly qualify as a data model. The flat (or table) model consists of a single, two-dimensional array of data elements, where all members of a given column are assumed to be similar values, and all members of a row are assumed to be related to one another. A flat file database describes any of various means to encode a database model (most commonly a table) as Flat model a single file (such as .txt or .ini). Hierarchical model: In this model data is organized into a tree-like structure, implying a single upward link in each record to describe the nesting, and a sort field to keep the records in a particular order in each same-level list. Records are interrelated through hierarchical or tree like structures. A parent record can Hierarchical model have several children, but a child can have only one parent. Network model: This model organizes data using two fundamental constructs, called records and sets. Records contain fields, and sets define one-to-many relationships between records: one owner, many members. A parent can have several children and a child can also have many parent records. Records are Network model physically linked through linked list.

Page 7 of 9

Roll No. 521126647

July 2011 Master of Computer Science (MSCCS) Semester 1 MC0067 Database Management System (DBMS and Oracle 9i) 4 Credits (Book ID: B0716 & B0717) Assignment Set 2 (40 Marks)
Relational model: is a database model based on first-order predicate logic. Its core idea is to describe a database as a collection of predicates over a finite set of predicate variables, describing constraints on the possible values and Relational model combinations of values. All data is maintained in form of relations (tables) consist of tuples (Records or Rows) and attributes (Fields or Column). Object-relational model: An object-relational database (ORD), or objectrelational database management system (ORDBMS), is a database management system (DBMS) similar to a relational database, but with an objectoriented database model: objects, classes and inheritance are directly supported Concept-oriented Model in database schemas and in the query language. In addition, it supports extension of the data model with custom data-types and methods. Star schema is the simplest style of data warehouse schema. The star schema consists of a few "fact tables" (possibly only one, justifying the name) referencing any number of "dimension tables". The star schema is considered Star schema an important special case of the snowflake schema.

Answer: 4(b) Schemas, Instances and Database States A database schema of a database system is its structure described in a formal language supported by the database management system (DBMS) and refers to the organization of data to create a blueprint of how a database will be constructed (divided into database tables). The formal definition of database schema is a set of formulas (sentences) that specify integrity constraints imposed on the database. All constraints are expressible in the same language. A database can be seen in terms of logic as a structure in a realization of the database language. The states of a created conceptual schema are transformed into an explicit mapping, the database schema. This describes how real world entities are modeled in the database. Database Instances: The term instance is typically used to describe a complete database environment, including the RDBMS software, table structure, stored procedures and other functionality. Instance is one of the main components of database and It is most commonly used when administrators describe multiple instances of the same database. It is also known as environment in technical terms. An organization with an employees database might have three different instances: production (used to store live data), pre-production (used to test new functionality prior to release into production) and development (used by database developers to create new functionality). Database state may refer to database state, in database technology the set of stored data. Entering, modifying, or deleting information changes the database state. A database is always in one specific state at a particular moment called database state. In a given database state, each schema construct has its own current set of instance. When we define a new database, we specify its schema only to DBMS. At this point, corresponding

Page 8 of 9

Roll No. 521126647

July 2011 Master of Computer Science (MSCCS) Semester 1 MC0067 Database Management System (DBMS and Oracle 9i) 4 Credits (Book ID: B0716 & B0717) Assignment Set 2 (40 Marks)
database state is empty. We get the initial state of database when that database is populated or loaded with initial data first time. Whenever any insertion, deletion or update operation is applied to database, a new database state is received. DBMS is partly responsible for ensuring the database states.

Page 9 of 9

Roll No. 521126647

Anda mungkin juga menyukai