1. List six major steps that you would take in setting up a database for a particular enterprise.
2. Suppose you want to build a video site similar to YouTube. Consider each of the points listed
in Section 1.2, as disadvantages of keeping data in a file-processing system. Discuss the
relevance of each of these points to the storage of actual video data, and to metadata about the
video, such as title, the user who uploaded it, tags, and which users viewed it.
3. List four significant differences between a file-processing system and a DBMS.
4. Explain the concept of physical data independence, and its importance in database systems.
5. Explain the difference between two-tier and three-tier architectures. Which is better suited for
Web applications? Why?
On the basis of given database tables shown above, solve the following
query-
Query 0. Retrieve the birth date and address of the employee(s) whose name is ‘John B. Smith’.
Q0: SELECT Bdate, Address
FROM EMPLOYEE
WHERE Fname=‘John’ AND Minit=‘B’ AND Lname=‘Smith’;
Output: fig (a)
Query 1. Retrieve the name and address of all employees who work for the ‘Research’ department.
Q1: SELECT Fname, Lname, Address
FROM EMPLOYEE, DEPARTMENT
WHERE Dname=‘Research’ AND Dnumber=Dno;
Output: fig (b)
Query 2. For every project located in ‘Stafford’, list the project number, the controlling department
number, and the department manager’s last name, address, and birth date.
Q2: SELECT Pnumber, Dnum, Lname, Address, Bdate
FROM PROJECT, DEPARTMENT, EMPLOYEE
WHERE Dnum=Dnumber AND Mgr_ssn=Ssn AND Plocation=‘Stafford’;
Output: fig (c)
Query 3. For each employee, retrieve the employee’s first and last name and the first and last name
of his or her immediate supervisor.
Q3: SELECT E.Fname, E.Lname, S.Fname, S.Lname
FROM EMPLOYEE AS E, EMPLOYEE AS S
WHERE E.Super_ssn=S.Ssn;
Output: fig (d)
Queries 4 - Select all EMPLOYEE Ssns in the database.
SELECT Ssn
FROM EMPLOYEE;
Output: fig (e)
Queries 5 -Select all combinations of EMPLOYEE Ssn and DEPARTMENT Dname in the database.
SELECT Ssn, Dname
FROM EMPLOYEE, DEPARTMENT;
Output: fig (f)
Query 6: Retrieves all the attribute values of any EMPLOYEE who works in DEPARTMENT number 5.
SELECT *
FROM EMPLOYEE
WHERE Dno=5;
Output: fig (g)
Output tables:
Query 7: Retrieve the salary of every employee.
SELECT ALL Salary
FROM EMPLOYEE;
Query 8: Retrieve all distinct salary values from employee.
SELECT DISTINCT Salary
FROM EMPLOYEE;
Query 8: Delete the record of employee whose last name is Brown.
DELETE FROM EMPLOYEE
WHERE Lname=‘Brown’;
Query 9: Delete the record of employee whose department no. is 5.
DELETE FROM EMPLOYEE
WHERE Dno=5;
Query 10: Delete the record of all employee.
DELETE FROM EMPLOYEE;
Query 11: Change the location and controlling department number of project number 10 to ‘Bellaire’
and 5, respectively.
UPDATE PROJECT
SET Plocation = ‘Bellaire’, Dnum = 5
WHERE Pnumber=10;