Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

Assignment-1 to 2 DBMS

The document contains assignments for a Database Management System course at Rajkiya Engineering College, Banda, for B. Tech 3rd Year students. It includes questions on architectural differences, SQL queries, E-R diagrams, and relational calculus expressions. The assignments cover theoretical concepts and practical SQL applications related to database systems.

Uploaded by

devsingh34052
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Assignment-1 to 2 DBMS

The document contains assignments for a Database Management System course at Rajkiya Engineering College, Banda, for B. Tech 3rd Year students. It includes questions on architectural differences, SQL queries, E-R diagrams, and relational calculus expressions. The assignments cover theoretical concepts and practical SQL applications related to database systems.

Uploaded by

devsingh34052
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment-1

RAJKIYA ENGINEERING COLLEGE, BANDA


Department of Information Technology
B. Tech 3RD Year / V Semester
DATBASE MANAGEMENT SYSTEM BCS-501

1. Explain the difference between two-tier and three-tier architectures. Which is better suited for Web
applications? Why?
2. List at least two reasons why database systems support data manipulation using a declarative query
language such as SQL, instead of just providing a a library of C or C++ functions to carry out data
manipulation.
3. Consider the time slot relation. Given that a particular time slot can meet more than once in a week,
explain why day and start time are part of the primary key of this relation, while end time is not.
4. Consider a database used to record the marks that students get in different exams of different course
offerings (sections).
a. Construct an E-R diagram that models exams as entities, and uses a ternary relationship, for the
database.
b. Construct an alternative E-R diagram that uses only a binary relationship between student and
section. Make sure that only one relationship exists between a particular student and section pair,
yet you can represent the marks that a student gets in different exams.
5. Design a generalization–specialization hierarchy for a motor vehicle sales company. The company sells
motorcycles, passenger cars, vans, and buses. Justify your placement of attributes at each level of the
hierarchy. Explain why they should not be placed at a higher or lower level
Assignment-2

RAJKIYA ENGINEERING COLLEGE, BANDA


Department of Information Technology
B. Tech 3RD Year / V Semester
DATBASE MANAGEMENT SYSTEM BCS-501
1) Write the following queries in SQL, using the university schema.
a. Find the titles of courses in the Comp. Sci. department that have 3 credits.
b. Find the IDs of all students who were taught by an instructor named Einstein; make sure there are
no duplicates in the result.
c. Find the highest salary of any instructor.
d. Find all instructors earning the highest salary (there may be more than one with the same salary).
e. Find the enrollment of each section that was offered in Autumn 2009.
f. Find the maximum enrollment, across all sections, in Autumn 2009.
g. Find the sections that had the maximum enrollment in Autumn 2009
h. Write the following inserts, deletes or updates in SQL, using the university schema.
a. Increase the salary of each instructor in the Comp. Sci. department by 10%.
b. Delete all courses that have never been offered (that is, do not occur in the section relation).
c. Insert every student whose tot cred attribute is greater than 100 as an instructor in the same
department, with a salary of $10,000.

2) Consider the SQL query


select distinct p.a1
from p, r1, r2
where p.a1 = r1.a1 or p.a1 = r2.a1
Under what conditions does the preceding query select values of p.a1 that are either in r1 or in r2? Examine
carefully the cases where one of r1 or r2 may be empty.
3) SQL allows a foreign-key dependency to refer to the same relation, as in the following example:
create table manager
(employee name varchar (20) not null,
manager name varchar (20) not null,
primary key employee name,
foreign key (manager name) references manager on deletes cascade)
Here, employee name is a key to the table manager, meaning that each employee has at most one manager.
The foreign-key clause requires that every manager also be an employee. Explain exactly what happens when
a tuple in the relation manager is deleted.
4) Consider the bank database. Let us define a view branch cust as follows:
create view branch cust as
select branch name, customer name
from depositor, account
where depositor.account number = account.account number
branch (branch name, branch city, assets)
customer (customer name, customer street, cust omer city)
loan (loan number, branch name, amount)
borrower (customer name, loan number)
account (account number, branch name, balance )
depositor (customer name, account number)
Suppose that the view is materialized; that is, the view is computed and stored. Write triggers to maintain the
view, that is, to keep it up-to-date on insertions to and deletions from depositor or account. Do not bother
about updates.
5) Let the following relation schemas be given:
R = (A, B,C)
S = (D, E, F)
1. Let relations r(R) and s(S) be given. Give an expression in the tuple relational calculus that is equivalent
to each of the following:

a. π A(r)
b. σ B = 17 (r)
c. r × s
d. π A,F (σ C = D(r × s))
2. Let R = (A, B, C), and let r1 and r2 both be relations on schema R. Give an expression in the domain
relational calculus that is equivalent to each of the following:
a. π A(r1)

c. r1 ∪ r2
b. σ B = 17 (r1)

d. r1 ∩ r2
e. r1 − r2
f. π A,B (r1) ⋈ π B,C (r2)

You might also like