Вы находитесь на странице: 1из 8

SABARAGAMUWA UNIVERSITY OF SRI LANKA B.Sc.

MANAGEMENT STUDIES YEAR I SEMESTER 1I EXAMINATION October, 2009 FM/BM 124 Database Management Systems & Network Technology Time: 03 hours Answer any five (05) questions. All questions carry equal marks.

1. 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 number, NID number, current address and phone, permanent address and phone, birth-date, sex, class(first-year, secondyear, ..., final-year), major department and degree program (B.A., B.Sc., ..., Ph.D.). Some user applications need to refer to the city and postal code of the student's last name. Both NID number and student number have unique values for each student. b. Each department is described by a name, department code, office phone, and college. Both name and code have unique values for each department. c. Each course has a course name, description, course code, number of semester hours, level and offering department. The value of course code is unique for each course. d. Each section has an instructor, semester, year, course, and section number. The section number distinguishes different sections of the same course that are taught during the same semester/year; its values are 1, 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 an ER diagram for that schema. Specify key attributes of each entity type and structural constraints on each relationship type. Note any unspecified requirements and make appropriate assumptions to make the specifications complete. (15 marks)

2. Consider the ER diagram shown in the following figure for part of a BANK database. Each bank can have multiple branches, and each branch can have multiple accounts and loans. a. List the regular entity types in the ER diagram. b. Is there a weak entity type? If so gave its name, its partial key, and its identifying relationship. c. What constraints do the partial key and the identifying relationship of the weak entity type specify in this diagram? d. List the names of all relationship types, and specify the (min, max) constraints on each participation of an entity type in a relationship type. Justify your choice. e. List concisely the user requirements that led to this ER schema design. f. Suppose that every customer must have at least one account but is restricted to at most two loans at a time, and that a bank branch cannot have more than 1000 loans. How does this show up on the (min, max) constraints?

Code

Name

Addr

BranchNo

BANK

Branches

BRANCH

Addr

Accts

AccNo

Loan

Type

LoanNo

ACCOUNT
Balance

Type

Amount

LOAN

A-C

L-C
NID Name

Phone

Addr

CUSTOMER

(15 marks)

Soln: a. BANK, ACCOUNT, LOAN, CUSTOMER b. Yes. BRANCH Partial Key BranchNo Identifying Relationship Branches c. BANK Code together with BranchNo can identify the specific branch. d. Relationship Types i. Branches (one-to-many) ii. Accts (one-to-many)

iii. Loan (one-to-many) iv. A-C (many-to-many) v. L-C (many-to-many) e. Each Bank identifying by its Code and Name can have multiple Branches identifying by the BranchNo and its Address. A Branch maintains different Types of multiple Accounts own to its Customers having Account Numbers with the available Balances. A Customer identified by the National ID number can maintain many accounts in a bank at the specified branch. Branch of the bank keep tracks of Names, National ID numbers Addresses and Phone numbers of its customers. Branch offers loans to its customers and customers can apply for multiple loans. Each loan is identified by a Loan number and keeps tracks of its Amount and loan Type. f.
Code Name Addr BranchNo

BANK

Branches

BRANCH

Addr

Accts

AccNo

Loan

Type

LoanNo

ACCOUNT
Balance

Type

(1, 10000)

(1, max)

Amount

LOAN

(0, 2)
A-C

L-C
NID Name

Phone

Addr

CUSTOMER

3. Answer the following questions. a. What do you mean by data organization? (03 marks) b. Compare the advantages and the disadvantages of computerized data organization methods over the non-computerized data organization methods. (03 marks) c. What do you mean by data modeling? (03 marks) d. What are Flat File databases and Relational databases? (03 marks) e. List and explain the parts of a Relational database. (03 marks)

Soln: a. Data organising is the process of arranging, representing and formatting data. For example, telephone books, dictionaries, recipe books, encyclopaedias and anything else which has organised and collected data to make it useful information which is designed to solve a problem and for a purpose. It will be organised and sorted alphabetically, numerically or in some other way which makes inherent sense of the data. b. Advantages and disadvantages of the Computerised data organization Over the NonComputerised data organization Advantages: Data can be easily edited instead of retyping Non-computerised systems require a larger physical storage space Data can be searched and retrieved quickly Flexibility with presentation style such as tables forms or reports. It is also easy to change from one style to the next and even change the method of presentation (i.e. multimedia instead of paper) Data can be accessed by several people at the same time (though it can be argued that this can be done with multiple printed copies), however the computerised system gives access to the latest most up to date information where as a paper based system would require another print out to update it. Backup of data is easy making the storage of the data safer (assuming that a reasonable backup system is in place. Access to confidential data is easily restricted (but of course in the old system access could also be restricted by locking confidential material in safes the difference is that access can be monitored by the use of passwords and restricting access to only those who need it. Far better for restricting access) Data can be sorted and searched by a number of criteria which makes it much easier to find information on a specific topic. The data can be easily manipulated and used in modelling and simulations to help make more accurate decisions.

Disadvantages: The power can go down part way through a data entry and without power the data stored cannot be accessed. The ethics of storing large amounts of private information on individuals is a big issue as information from web forms becomes more prolific. Who should have the right to this information and what rights as an individual do we have (see the section on Issues related to databases)

c. Data modeling is the process of identifying entities, the relationship between those entities and their attributes. It is a phrase used to describe the tools and the process of identifying entities required for a database, the relationship between those entities and the attributes of those entities. In fact data modelling is all of the processes required for the design of the database prior to building it. There are a range of tools used to achieve this such as data dictionaries, decision trees, decision tables, schematic diagrams and the process of normalization. d. A flat file database is simply a table that is sorted by one of the fields (columns). Flat file databases are simple to create and organise. They look like a spreadsheet. Each column represents a field and each row represents a record of fields. The table is sorted by one of the fields. However while they are easy to use they require more work to maintain due to the high level of data redundancy and are only suitable for files with less than 100 records. A database is a collection of related records stored in files. The elements of a flat file database are: Files: a collection of related records. It looks much the same as a spreadsheet but with named columns. A Record: is a collection of information about one specific topic (i.e. it might contain all the information about a student called John Smith. If the file is sorted alphabetically then the next name will come after Smith and might be all the records about Penny Thompson including all the fields which might be class, age, address, home phone number). A field: These are the columns in a flat file database and are usually named at the top of that column. For the example of Penny Thompson one field would be her name, another one would be her home phone number).

A relational database organizes information through a series of related tables. Relational databases are the most commonly used type of database. A relational database consists of a collection of tables that store particular sets of data. The invention of the relational database system has standardized the way that data is stored and processed. Most of the database management systems used today are based on the relational system. Relational databases have the following features: Every table is divided into a series of records, which are comprised of fields in the same way as a flat file database. Every table has one of the fields designated as a key field which is used to sort, index and link the data between the tables. Reduced data redundancy due to normalization of the data Reduced time to update data due to normalization of the data Consistent reports because of validation and integrity of data Centralized security. Instead of data being split between several files it is all in one centralized file which is consistently updated. The schema shows an overall view of the data and of the relationships between the tables. Data can be viewed for different purposes according to the search, queries or reports that are run.

e. Parts of a Relational Database: Entity: is a topic or specific thing about which information is being collected. For instance if it is a school database the entities (topics) about which information might be collected are such things as students, teachers and classes. If it was a flat file database we would probably have a separate table for each one. Attribute: is a defined property of an entity. In the school example an attribute of student (which is an entity) might be name or student ID. Attributes are the same thing as fields in a flat file database.

Key field: Any field that can be used to sort the data is a "key field" as opposed to the primary key which is a designated attribute (field) which is used to sort but also to index and link one table to another. A key is an entity in a table that distinguishes one row of data from another. The key may be a single column, or it may consist of a group of columns that uniquely identifies a record. Tables can contain primary keys which differentiates records from one another. Primary Keys: Primary keys are unique fields. Primary keys can be an individual attribute, or a combination of attributes. A field which is a primary key must not be null. Foreign Key: is the primary key of another table. In the example of a school database student ID may well come under loans in a library/ loans table as well as in its own student table. Foreign keys relate tables in the database to one another. A foreign key in one table is a primary key in another. The foreign keys generally define parent-to-child relationships between tables. Table: information about an entity is stored in tables. A table contains columns and rows. A row in a table is called a tuple of an entity and represents a record. A column of a table is also called the attribute. In a flat file database it is referred to as a field. In a relational database it may be called an attribute or field. Tables can be related to each other in a variety of ways. Functional dependencies are formed when an attribute of one table relates to attributes of other tables. The simplest relationship is the one-to-one relationship, in which one record in a table is related to another record in a separate table. A one-to-many relationship is one in which one record in a table is related to multiple records in another table. A many-to-one relationship defines the reverse situation; more than one record in a single table relates to only one record in another table. Finally, in a many-to-many relationship, more than one record in a table relates to more than one record in another table. Relationships: This refers to the link between the various tables and is usually made through a primary key in the primary table linking through to a field in the secondary table. The relation is the critical element of storage in a relational database, which is a two-dimensional table. A relational database can contain two or more of these tables. Each table consists of a unique set of rows and columns. A single record is stored in a table as a row, also known as a tuple. Attributes of the data are defined in columns, or fields, in the table. The characteristics of the data, or the column, relates one record to another. Each column has a unique name and the content within it must be of the same type.

4. Answer the following questions. a. What are the phases of database design process? Explain each phase briefly. (08 marks) b. To keep information about invoices, movies and customers in a relational database to be used in a video library required to be implemented will have the following tables. Write SQL statements for the following queries.

Movie Table:
MOV-NO TITLE TYPE RATING STAR QTY PRICE

Customer Table:
CUST-ID LAST NAME FIRST NAME GENDER CITY CREDIT

Invoice Table:
INV-NO CUST-ID TOTAL RENTED RETURNED

Invoice-Movie Table:
INV-NO MOV-NO

i. ii. iii. iv. v. vi. vii.

Display the titles and stars of all the movies. Display the invoice number, rental date and return data for all the invoices. Display the movie type from movie table. Display all the stars from the movie table. Display different stars from the movie table. Display different movie types from the movie table. Find out which movies have been rented by displaying the different movie numbers on the invoice-movie table. (07 marks)

Soln: a. The database design process can be broken down into four phases. Phase 1 - Requirements Collection and analysis phase: Prospective database users are interviewed to understand and document their data requirements. Phase 2 - Conceptual Design: This is the high level description of the structure of a database (E.g. E-R diagram). Includes concise description of the data requirements of the users and detailed descriptions of the data, relationships and constraints. Phase 3 - Logical Design: This is the process of mapping the database structure developed in the previous phase to a particular database model (E.g. map E-R model to relational model). Specific to a database model, but independent of a particular DBMS (product). Phase 4 - Physical Design: This is the process of defining structure that enables the database to be queried in an efficient manner (E.g. index and hash file design, data partition etc.).

b. SQL statements for the quires: i. ii. iii. iv. v. vi. SELECT TITLE, STAR FROM Movie; SELECT INV-NO, RENTED, RETURNED FROM Invoice; SELECT TYPE, FROM Movie; SELECT STAR FROM Movie; SELECT DISTINCT STAR FROM Movie; SELECT DISTINCT TYPE FROM Movie;

5. Answer the following questions. a. By mentioning the basic types, topologies and protocols explain what a Computer Network is? (05 marks) b. Give advantages and disadvantages of installing a computer network in your organization to perform the activities of your business. (10 marks)

6. Computerization of business processes; technological advances such as invention of computer networks and Internet in transmission and storage of data; and powerful database management tools have opened up new possibilities of data manipulation and analysis in a business. Business managers use them for taking intelligent business decisions. In this context, industries are increasingly focusing on these and other related technologies. Comment on the above. 7

(15 marks) 7. Write short notes on the followings. a. SQL and what can SQL do? b. E-R diagrams and Relationship Types c. Entity, Relationship, Attribute d. LAN, MAN and WAN e. Peer-to-Peer and Client-Server networks (5 x 3 = 15 marks)

Вам также может понравиться