CSC 313 Past Questions Answer

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 6

CSC 313 PAST QUESTIONS Answer

1.

a. Developers hide the complexity of database-system from users through several levels of abstraction
to simplify users' interaction with the system. Discuss the three levels of abstraction that helps to
achieve this.

Answer
The three levels of abstraction are:

Physical level, logical level and view level.

i. Physical Level:

The lowest level of abstraction describes how the data are actually stored. The physical level describes
complex low-level data structures in detail.

ii. Logical Level:


The next-higher level of abstraction describes what data are stored in the database, and what
relationships exist among those data. The logical level thus describes the entire database in terms of a
small number of relatively simple structures. The user of the logical level does not need to be aware of
this complexity. This is referred to as physical data Independence.Database administrators, who must
decide what information to keep in the database, use the logical level of abstraction.

iii. View level:


The highest level of abstraction that describes only part of the entire database. Many users don't need
access to all information in the database, instead, they need to access only a part of the database. The
view level of abstraction exists to simplify their interaction with the system. The system may provide
many views for the same database.

b.

i. SELECT title

FROM course

prepared by Antoni
WHERE dept_name='computer science' AND credit=3;

ii. SELECT instructor.id, course.title

FROM instructor NATURAL JOIN teaches NATURAL JOIN course

WHERE instructor.dept_name='physics';

iii. UPDATE instructor

SET salary=salary*0.10;

C.

i. SELECT firstName, lastName

FROM student

WHERE matricNo=2034000002;

ii. SELECT firstName, last name

FROM student

ORDER BY lastName ASC;

iii. UPDATE student

SET lastName='Zinwota'

WHERE matricNo=2034000004;

prepared by Antoni
2.

a. Discuss the following integrity constraints that are implemented by databases systems;

*Assertions

*Authorization

* Domain constraints.

Answer
Assertions:

An assertion is a condition that we wish the database always to satisfy before a query.

An assertion in SQL takes the form:

CREATE ASSERTION <assertion-name> CHECK <predicate>;

When an assertion is created, the system tests it for validity. If the assertion is valid, then any future
modification to the database is allowed only if it does not cause that assertion to be violate.

Authorization:

Authorization is a mechanism which differentiate among the users of the database on the type of access
they are permitted on various data values in the database.

Authorizations on data include:

• Authorization to read data.

• Authorization to insert new data.

• Authorization to update data.

• Authorization to delete data.

Each of these types of authorizations is called a privilege. We may authorize the user all, none, or a
combination of these types of privileges on specified parts of a database, such as a relation or a view.

Domain Constraints:

Domain constraints specify the set of possible values that may be associated with an attribute.

Such constraints may also prohibit the use of null values for particular attributes.

3.

prepared by Antoni
a.

i. Explain why views are useful in SQL operations?

Answer
Views are useful for hiding unneeded information and for gathering together information from more
than one relation into a single view.

ii. Show the syntax for defining a view

Answer
CREATE VIEW v AS <query expression>;

iii. & iv.

Answer(iii)
CREATE VIEW instructor_view AS

SELECT id, name, dept_name FROM instructor;

Answer (iv)

b.

Answer

i.

prepared by Antoni
5.

a.

Give the appropriate names for all the definitions below as used in relational algebra
-A table with rows and columns

(Relation)
- A row of a relation

(Tuple)
- Named column of a relation

(Attribute)
- set of allowable values for one or more attributes

(Domain)
-Number of attributes in a relation

(Degree)
- Number of tuples in a relation

(Cardinality)
-A collection of normalized relation with distinct relation names

(Relational Database)

b.

Explain why relational algebra is considered a procedural query language and give at least 2
distinctive attributes that set relational algebra as a procedural query language from other kinds of
query languages.

Answer
Because it specify what data is required and how to get it.

prepared by Antoni
1. The order is specified in which the operations have to be performed.

2. It specify how to obtain the result.

c.

State the expression for the operations below and the requisite conditions that must be met before a
function can be executed.

-Select

σpredicate(relation)

-project

Πattributes(relation)

-union

r∪s

Where r and s are relations

prepared by Antoni

You might also like