Monday, April 30, 2012

PEQ2012


Practical exam Q No. 1
Q-1> Write a query in sql to create a table employee and department.
Employee(empno,ename,deptno,job,hiredate)
Department(deptno,dname,loc)
Include the following constraints on column of emp table.
a) to make the empno as primary key of the table and
b) to ensure that the ename column does not contain NULL values and
c) the job column to have only UPPERCASE entries and
d) to put the current date as default date in hire date column in case data is not supplied for the column.
Include the following constraints on column of dept table.
a) to make deptno as primary key.
b) to ensure dname,loc coloumns does not contain NULL values
Also enforce REFERENTIAL INTEGRITY, declare deptno field of dept table as primary key and deptno field of emp table as foreign key.
Q-2> Modify the above table to add three more columns salary,mgr,comm to the emp table. add salary column with constraint greater than zero and modify the width of sal column.
Q-3> Insert following values in employee table.
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
Q-4> Edit the commission of JONES to 1000.
Q-5> Retrieve all rows of employee table.
Q-6> Delete row from employee table where deptno is 10.
Q-7> Delete all rows from employee table then Drop the emp table.



Practical exam Q No. 2
Q. Create a Database for the “university registrar’s office” requirements are given below:
A university registrar’s office maintains data about the following entities: (a)
courses, including number, title, credits, syllabus, and prerequisites; (b) course
offerings, including course number, year, semester, section number, instructor(s),
timings, and classroom; (c) students, including student-id, name, and program;
and (d) instructors, including identification number, name, department, and title.
Further, the enrollment of students in courses and grades awarded to students
in each course they are enrolled for must be appropriately modeled.
Construct an E-R diagram for the registrar’s office. Document all assumptions
that you make about the mapping constraints.
Note: First create E-R model, convert E-R model to table, Finally create the database using create table query.










Practical exam Q No. 3

Q. Create a Database for the “Banking Enterprise”:

Note: First create E-R model, convert E-R model to table, Finally create the database using create table query.



Practical exam Q No. 4

Q. Create a Database for the “University Database”:

Consider a university database for the scheduling of classrooms for final exams.
This database could be modeled as the single entity set exam, with attributes
course-name, section-number, room-number, and time. Alternatively, one or more
additional entity sets could be defined, along with relationship sets to replace
some of the attributes of the exam entity set, as
course with attributes name, department, and c-number
section with attributes s-number and enrollment, and dependent as a weak
entity set on course
room with attributes r-number, capacity, and building
a. Show an E-R diagram illustrating the use of all three additional entity sets
listed.
b. Explain what application characteristics would influence a decision to include
or not to include each of the additional entity sets.

Note: First create E-R model, convert E-R model to table, Finally
create the database using create table query.









Practical exam Q No. 5

Q. Create a Database for the “Banking Enterprise”:
Note: First create E-R model, convert E-R model to table, finally create the database using create table query.









Practical exam Q No. 6
Q. Consider the employee database of Figure below, where the primary keys are underlined.
Give an expression in SQL for each of the following queries.

employee (employee-name, street, city)
works (employee-name, company-name, salary)
company (company-name, city)
manages (employee-name, manager-name)

a. Find all employees in the database who live in the same cities as the companies
for which they work.
b. Find all employees in the database who live in the same cities and on the
same streets as do their managers.
c. Find all employees in the database who do not work for First Bank Corporation.
d. Delete all tuples in the works relation for employees of Small Bank Corporation.



Practical exam Q No. 7

Q. Consider the employee database of Figure below, where the primary keys are underlined.
Give an expression in SQL for each of the following queries.

employee (employee-name, street, city)
works (employee-name, company-name, salary)
company (company-name, city)
manages (employee-name, manager-name)

a. Find all employees in the database who earn more than each employee of
Small Bank Corporation.
b. Assume that the companies may be located in several cities. Find all companies
located in every city in which Small Bank Corporation is located.
c. Find all employees who earn more than the average salary of all employees
of their company.
d. Find the company that has the most employees.


Practical exam Q No. 8

Q. Consider the insurance database of Figure below, where the primary keys are underlined.
Construct the following SQL queries for this relational database.

person (driver-id, name, address)
car (license, model, year)
accident (report-number, date, location)
owns (driver-id, license)
participated (driver-id, car, report-number, damage-amount)
a. Find the total number of people who owned cars that were involved in accidents
in 1989.
b. Find the number of accidents in which the cars belonging to “John Smith”
were involved.
c. Delete ‘Santro’ belonging ‘John Smith’


Practical exam Q No. 9

Q. Consider the insurance database of Figure below, where the primary keys are underlined.
Construct the following SQL queries for this relational database.

person (driver-id, name, address)
car (license, model, year)
accident (report-number, date, location)
owns (driver-id, license)
participated (driver-id, car, report-number, damage-amount)


a. Add a new accident to the database; assume any values for required attributes.
b. Delete the Mazda belonging to “John Smith”.
c. Update the damage amount for the car with license number “AABB2000” in
the accident with report number “AR2197” to $3000.







Practical exam Q No. 10


Q-1> Give list of emp name & their job spec who are working in dept no 20 ?
Q-2> Compile the details of emp working in dept no 30 ?
Q-3> Find list of emp whose empno is greater then manager no ?
Q-4> Find all manager not in dept no 10 ?
Q-5> To find the total number of employees.
Q-6> To find the total number of clerk hired after 13-jan-81.
Q-7> Determine which department have more then two people holding a particular job?
Q-8> Find all department that have at least two clerk?
Q-9> Retrieve emp name and job who have the same job as that of allen?
Q-10> List all emp name and their job of those depts. That are located at Chicago?




Practical exam Q No.11

Q-1> Create a table client master with the following fields client_no, name, address1, address2, city, state, pin_code, remarks, balance due and add the constraints?
• Create a primary key constraint on the column client_no.?
• create the following check constraints
Data values being inserted into the column client_no must start with ‘c’.
à
 Data values being inserted into the column name should be allowed in upper case only?
à
Q-2> Insert five rows in the table client master?
Q-3> Show all rows of client master?
Q-4> Add a new column in your table : AGE ?
Q-5> Update the table client master ?
Q-6> Delete a row from client master where age is greater then 60?
Q.7> Create table supplymaster (supplierno,suplliername,address1,address2,city,state,
pincode,remarks,baldue) by using clientmaster.
Q.8> Insert values in table supplymaster by using clientmaster.
Q-9> Drop table client master?






Practical exam Q No. 12


Q-1> Display everyone in dept no 20 who is neither a clerk, salesman nor analyst ?
Q-2> List all emp names, their jobs, salary in ascending order by theire jobs ?
Q-3> Obtain list of all empno and names who are manager ?
Q-4> Display names of all emp whose comm is greater then salary ?
Q-5> To find the sum paid as salary to all employees every month.
Q-6> To find the yearly compensation paid to all sales men.
Q-7> Divide all employee into group dept and job and also specify deptno?
Q-8> List all emp name and sal whose sal is greater then that of all managers?
Q-9>display all emp names and sal where sal is less then that of any manager of any dept?
Q-10> To find the minimum salary of managers in various depts.







Practical exam Q No. 13

Q-1> Find list of emp whose sal is greater then 2000 along with their job spec ?
Q-2> Give list of all emp along with their monthly and annual income ?
Q-3> List all empname who are ordered by the jobs within each job there should be Descending order by empno ?
Q-4> Retrieve details of emp whose sal is between 1000 and 2000 both inclusive?
Q-5> To find the average salary of all the employees.
Q-6> To find the average yearly compensation paid to sales men.
Q-7> List annual salary from all job consisting of more then one employee?
Q-8> List all dept with atleast one analyst?
Q-7> To find the minimum salary of managers in various depts. Having salary greater than 2500.
Q-10> To select all employees sorted dept wise in ascending order and within dept salary wise in descending order for dept no. 10 and 20.






Practical exam Q No. 14

Q-1> List the job that have average annual salary greater than all manager?
Q-2> Find the no of employees and job group by deptno?
Q-3> List all emp names and their salaries who are working in dept no 10 ?
Q-4> Give details of all dept and their no’s while changing the column name as department and department no ?
Q-5> To find the minimum salary paid to any employee
Q-6> To list the employee who heads the list alphabetically.
Q-7> List all emp name, dept names and location whose deptno is common in both dept table and emp table?
Q-8> List all jobs in dept 10 and 20 or in both?
Q-9> To select all employees along with their annual salary sorted on the basis of annual salary.
Q-10> To find the minimum salary of managers in various depts.







Practical exam Q No. 15

Q-1> List all jobs which are common in dept 10 and 20 ?
Q-2> List all jobs which are present in dept 10 but not in dep 20?
Q-3> List all managers with their respective name manager and deptno ?
Q-4> Display list of emp whose job is analyst ?
Q-5> To list all the employees hired during the year 1982
Q-6> To get all employees from dept 10 and 20.
Q-7> To list all employees whose name begins with ‘J’.
Q-8> Retrieve all details of employees whose name is either smith, blake, allen, scott, clark and King ?
Q-9> Create view on appropriate tables to display ename , job , sal , dept name?
Q-10> Drop the above view?








Practical exam Q No. 16

Q-1> To list all employees whose salary is greater than or equal to 2000.
Q-2> To list employees whose name begins with ‘J’ and has ‘N’ as the third character?
Q-3> To list all employees not entitled for commission.
Q-4> To list all employees who receive commission.
Q-5> To get all the employees whose salary is greater than the average salary of the company.
Q-5> Create unique index on job on the emp table.
Q-6> Remove the index created for the emp table.
Q-7> To find out average minimum and maximum salary of each dept.
Q-8> Create view on emp to display sum of salary grouped according to deptno?
Q-9> Drop the above view?
Q-10> To select all employees along with their annual salary sorted on the basis of annual salary.





Practical exam Q No. 17

Q-1> Create view on emp displaying deptno , dept name , sal , job.
Q-2> Drop the above view.
Q-3> To select all the employees who do the same job as that of Scott.
Q-4> To see all details of depts. Who have employees working in it.
Q-5> To find out average maximum and minimum salary of departments where average salary is greater than 2000.
Q-6> To list the minimum salary to various categories of employees.
Q-7> To list employees working in dept no 10 or 20.
Q-8> To list employees hired after 01-jan-81 and working in dept no. 10
Q-9> To find names and salary details of all employees whose salary is equal to the salary given to an employee working in dept no. 30
Q-10> To select all employees along with their annual salary sorted on the basis of annual salary.






Practical exam Q No. 18

Q-1> To list employees working in dept other than 10.
Q-2> To find the minimum salaries of various categories of employees in various depts.
Q-3> To find the minimum salaries of various categories of employees, department wise such that minimum salary is greater than 1500.
Q-4> Create view on emp displaying ename , job ,sal in dept 10.
Q-5> Drop the above view.
Q-6> To select the employees whose salary is greater than the salary of all employees working in dept no. 30
Q-7> To list all employees in the ascending order by name.
Q-8> To select all employees sorted dept wise in ascending order and within dept salary wise in descending order.
Q-9> To select all employees along with their annual salary sorted on the basis of annual salary.
Q-10> To find the minimum salary of managers in various depts.







Practical exam Q No. 19



Q-1> Creat the following table and insert the given value.

Employees:
Emp_id Name
01 Hansen,Ola
02 Svendson, Tova
03 Svendson, Stephen
04 Pettersen, Kari

Orders:
Prod_id Product Emp_id
234 Printer 01
657 Table 03
865 Chair 03

Q-2> Who ordered a product and what did they order.
Q-3> Who ordered a printer.
Q-4> List all the employees and their order if any.
Q-5> List all orders and who has ordered if any.



Practical exam Q No. 20

Q. Consider the employee database of Figure below, where the primary keys are underlined.
Give an expression in SQL for each of the following queries.

employee (employee-name, street, city)
works (employee-name, company-name, salary)
company (company-name, city)
manages (employee-name, manager-name)


a. Find the names of all employees who work for First Bank Corporation
b. Find the names and cities of residence of all employees who work for First
Bank Corporation.
c. Find the names, street addresses, and cities of residence of all employees
who work for First Bank Corporation and earn more than $10,000.
d. Modify the database so that Jones now lives in Newtown.


4 comments:

Lecture PPTs of MIS , Module 4 to Module 6

 Module 4 Social Computing (SC): Web 3.0 , SC in business-shopping, Marketing, Operational and Analytic CRM, E-business and E-commerce B2B B...