0% found this document useful (0 votes)
8 views

ADBMS-Assignment

ADBMS Assignment

Uploaded by

Fahim Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

ADBMS-Assignment

ADBMS Assignment

Uploaded by

Fahim Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

a) Construct an ER diagram for a hospital along with a set of patients and a set of
medical doctors Associate with every patient a log of the several tests and
examinations conducted.

b) This Hospital Management System Database Design has an ER Diagram for Hospital
Management System project. This material includes database schema.
c) Necessary SQL command for different reports of tests, bill, doctor’s prescription and
admission information.

CREATE TABLE Person


(
PatientID int,
Report_Of_Test Text,
Bill int,
Prescription Text,
Admission_Info Text
);
2. The decomposition of R into R1 and R2 can be called as lossless join decomposition if
any one of the following conditions holds true:
1. R1 ∩ R2 → R1
2. R1 ∩ R2 → R2
II. R1 = (A, B, C), R2 = (A, D, E) ….Given
Hence, R1 ∩ R2 = A
III. It can also be proved that A is a candidate key as follows:

1. Since A → BC, we can conclude: A → B and A → C.


2. Since A → B and B → D, A → D ……. (Decomposition, transitive)
3. Since A → CD and CD → E, A → E …… (Union, decomposition, transitive)
4. Since A → A… (Reflexive)
5. A → ABCDE from the above steps … (Union) Hence, R1 ∩ R2 → R1 Thus, the
decomposition mentioned is a lossless decomposition.

3) Compute the closure of the following set F of functional dependencies for relation
schema r (A, B, C, D, E).
A→BC
CD→E
B→D
E→A

List the candidate keys for R.


4) A university database schema is given below:

Data Definition Language (DDL)

o DDL changes the structure of the table like creating a table, deleting a table, altering a
table, etc.
o All the command of DDL are auto-committed that means it permanently save all the
changes in the database.

Here are some commands that come under DDL:

o CREATE
o ALTER
o DROP
o TRUNCATE
a. CREATE It is used to create a new table in the database.
b. DROP: It is used to delete both the structure and record stored in the table.
c. ALTER: It is used to alter the structure of the database. This change could be either
to modify the characteristics of an existing attribute or probably to add a new
attribute.
d. TRUNCATE: It is used to delete all the rows from the table and free the space
containing the table.

you probably want tables for:


student (id, name, whatever)
course (id, name, subject/dept)
section (id, course id and time info)
student_to_section (student id, section id)

As for your free-time, find the time periods for all sections taken by a student and free time is
whats left. The following will give the time blocks where a student is BUSY.

SELECT T.*
FROM section S
INNER JOIN time_blocks T on S.time_id = T.id
INNER JOIN student_to_section STS on STS.section_id = S.id
WHERE STS.student_id = ###

For free time, use:


SELECT T2.*
FROM time_blocks T2
WHERE T2.id NOT IN (put above statement here)

5)
 Write down relational algebra to express the following queries:
(i) Find the names of all employees who do not work in Sonali Bank.
SELECT *
FROM Sonali_Bank
WHERE EMPLOY_ID NOT IN;

(ii) Find the names of all employees who lives in Dhaka.


SELECT customer.cust_name,
salesman.name, salesman.city
FROM salesman, customer
WHERE salesman.city = customer.city;

(iii) Find the names of all employee whose manager name is Md. Salam Mia.

SELECT first_name, last_name


FROM employees
WHERE (employee_id IN (SELECT manager_name FROM employees));
 Write down SQL command for the following queries:
(i) Find the employees whose salary is between 50,000 to 80,000 Taka.
SELECT * FROM employees
WHERE salary BETWEEN 50000 and 80000;

(ii) Find out the total amount of salary of Sonali Bank of Gazipur City.
SELECT SUM(salary) AS "Total Salary"
FROM employees
WHERE salary > 80000;
(iii) Sort the name of all employee of AB Bank of Uttara.
SELECT first_name, last_name, employees _name
FROM employees
WHERE employees _name IN (30, 100)
ORDER BY employees _name ASC;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy