Dbmspartbanswers
Dbmspartbanswers
Explain Distributed and Client/Server database. (5) Refer book chapter 18.1.2,19 3. Consider the following relational database employee (employee-name, street, city) works ( employee-name, company-name, salary) company (company-name, city) manages (employee-name, manager-name) Give an expression in SQL to express each of the following queries : 1. Find the names and cities of residence of all employees who work for XYZ Bank. 2. Find the names, street address, and cities of residence of all employees who work for XYZ Bank and earn more than Rs. 10,000 per annum. 3. Find the names of all employees in this database who live in the same city as the company for which they work. 4. Find the names of all employees who live in the same city and on the same street as do their managers. (3+4+4+4 ) ANSWERS: 1. select e.employee-name,e.city from from employee e,works w where e.employeename=w.employee-name and w.company-name=XYZ; 2. select e.employee-name,e.street,e.city from employee e,works w where e.employeename=w.employee-name and w.company-name =XYZ and w.salary > =10000; 3. select e.employee name from employee e, works w, company c where e.employee name = w.employee name and e.city = c.city and w.company name = c.company name; 4. select P.employee name from employee P, employee R, manages M where P.employee name = M.employee name and M.manager name = R.employee name and P.street = R.street and P.city = R.city; 4. Explain with example Trigger.(7) Refer book chapter 6.4 5. Discuss in detail about functions and procedure with example.(8) Refer the Advanced sql pdf attached. 6. Consider the relational database employee (empname, street, city) works (empname, companyname, salary) company (companyname, city) manages (empname, managername). Give the SQL queries for each request. 1. Find the names of all employees who work for first bank Corporation. 2. Find the names, street addresses and cities of residence of all employees who work for first Bank Corporation and earn more than 200000 per annum. 3. Find the names of all employees in this database who live in the same city as the
company for which they work. 4. Find the names of all employees who earn more than every Employees of small Bank Corporation. (3+4+4+4) ANSWERS: 1. select e.employee-name from employee e ,works w where where e.employeename=w.employee-name and `company name = first bank Corporation; 2. same as 3rd ques->2 3. same as 3rd ques->3 4. select employee-name from works where salary >all (select salary from works where company-name =Small Bank Corporation) 5. What are nested queries? Explain with example. (7) Refer the sql pdf attached.