Practical List: C U S T
Practical List: C U S T
Practical List: C U S T
Note: Following Practical(s) are to be implemented on Oracle, DB2, Microsoft, NoSql and MongoDB
Sr.
Aim Of the Practical Hrs.
No.
DEPOSIT 4
ACTNO CNAME BNAME AMOUNT ADATE
BRANCH
VRCE NAGPUR
AJNI NAGPUR
KAROLBAGH DELHI
CHANDI DELHI
DHARAMPETH NAGPUR
M.G.ROAD BANGLORE
ANDHERI BOMBAY
VIRAR BOMBAY
POWAI BOMBAY
CUSTOMERS
ANIL CALCUTTA
SUNIL DELHI
MEHUL BARODA
MANDAR PATNA
MADHURI NAGPUR
PRAMOD NAGPUR
SANDIP SURAT
SHIVANI BOMBAY
KRANTI BOMBAY
NAREN BOMBAY
BORROW
2 Create the below given table and insert the data accordingly. 4
job_id Varchar2(15)
job_title Varchar2(30)
min_sal Number(7,2)
max_sal Number(7,2)
emp_no Number(3)
emp_name Varchar2(30)
emp_sal Number(8,2)
emp_comm Number(6,1)
dept_no Number(3)
a_no Varchar2(5)
cname Varchar2(15)
bname Varchar2(10)
amount Number(7,2)
a_date Date
loanno Varchar2(5)
cname Varchar2(15)
bname Varchar2(10)
amount Varchar2(7,2)
(6) Create table supplier from employee with all the columns.
(7) Create table sup1 from employee with first two columns.
(14) Update the value dept_no to 10 where second character of emp. name is ‘m’.
(15) Update the value of employee name whose employee number is 103.
(16) Add one column phone to employee with size of column is 10.
(18) Count the total no as well as distinct rows in dept_no column with a condition of salary
greater than 1000 of employee
(19) Display the detail of all employees in ascending order, descending order of their
name and no.
(20) Display the dept_no in ascending order and accordingly display emp_comm in
descending order.
(21) Update the value of emp_comm to 500 where dept_no is 20.
(22) Display the emp_comm in ascending order with null value first and accordingly sort
employee salary in descending order.
(23) Display the emp_comm in ascending order with null value last and accordingly sort
emp_no in descending order.
(1) Write a query to display the current date. Label the column Date
(2) For each employee, display the employee number, job, salary, and salary increased by 15%
and expressed as a whole number. Label the column New Salary
(3) Modify your query no 4.(2) to add a column that subtracts the old salary from the new
salary. Label the column Increase
(4) Write a query that displays the employee’s names with the first letter capitalized and all
other letters lowercase, and the length of the names, for all employees whose name starts with
J, A, or M. Give each column an appropriate label. Sort the results by the employees’ last
names.
(5) Write a query that produces the following for each employee:
<employee last name> earns <salary> monthly
(6) Display the name, hire date, number of months employed and day of the week on which the
employee has started. Order the results by the day of the week starting with Monday.
(7) Display the hiredate of emp in a format that appears as Seventh of June 1994 12:00:00 AM.
(8) Write a query to calculate the annual compensation of all employees (sal+comm.).
(2) Give name of customer who are borrowers and depositors and having living city nagpur
(3) Give city as their city name of customers having same living branch.
(4) Write a query to display the last name, department number, and department name for
all employees.
(5) Create a unique listing of all jobs that are in department 30. Include the location of the 4
department in the output
(6) Write a query to display the employee name, department number, and department name for
all employees who work in NEW YORK.
(7) Display the employee last name and employee number along with their manager’s last
name and manager number. Label the columns Employee, Emp#, Manager, and Mgr#,
respectively.
(8) Create a query to display the name and hire date of any employee hired after employee
SCOTT.
(1) List total deposit of customer having account date after 1-jan-96.
(4) Display the highest, lowest, sum, and average salary of all employees. Label the columns
Maximum, Minimum, Sum, and Average, respectively. Round your results to the nearest
whole number.
(5) Write a query that displays the difference between the highest and lowest salaries. Label
the column DIFFERENCE.
(6) Create a query that will display the total number of employees and, of that total, the
number of employees hired in 1995, 1996, 1997, and 1998
(7) Find the average salaries for each department without displaying the respective department
numbers.
(8) Write a query to display the total salary being paid to each job title, within each
department.
(9) Find the average salaries > 2000 for each department without displaying the respective
department numbers.
(10) Display the job and total salary for each job with a total salary amount exceeding 3000, in
which excludes president and sorts the list by the total salary.
(11) List the branches having sum of deposit more than 5000 and located in city bombay.
(1) Write a query to display the last name and hire date of any employee in the same
department as SCOTT. Exclude SCOTT
(2) Give name of customers who are depositors having same branch city of mr. sunil.
(3) Give deposit details and loan details of customer in same city where pramod is living.
(4) Create a query to display the employee numbers and last names of all employees who earn
more than the average salary. Sort the results in ascending order of salary.
(5) Give names of depositors having same living city as mr. anil and having deposit amount 4
greater than 2000
(6) Display the last name and salary of every employee who reports to ford.
(7) Display the department number, name, and job for every employee in the Accounting
department.
(9) Give the name of cities where in which the maximum numbers of branches are located.
(10) Give name of customers living in same city where maximum depositors are located.
8 Manipulating Data 4
(3) Give 10% interest to all depositors living in nagpur and having branch city bombay.
(4) Write a query which changes the department number of all employees with empno 7788’s
job to employee 7844’current department number.
(5) Transfer 10 Rs from account of anil to sunil if both are having same branch.
(6) Give 100 Rs more to all depositors if they are maximum depositors in their respective
branch.
(9) Delete borrower of branches having average loan less than 1000.
Write a PL-SQL block for checking weather a given year is a Leap year or not
Find out whether given string is palindrome or not using For, While and Simple
Loop.
11 To understand the concept of “select into” and “% type” attribute. 2
Create an EMPLOYEES table that is a replica of the EMP table. Add a new column, STARS,
of VARCHAR2 data type and length of 50 to the EMPLOYEES table for storing asterisk (*).
Create a PL/SQL block that rewards an employee by appending an asterisk in the STARS
column for every Rs1000/- of the employee’s salary. For example, if the employee has a salary
amount of Rs8000/-, the string of asterisks should contain eight asterisks. If the employee has a
salary amount of Rs12500/-, the string of asterisks should contain 13 asterisks.
Update the STARS column for the employee with the string of asterisks.
Write a PL/SQL block to update the salary where deptno is 10. Generate trigger that will
store the original record in other table before updation take place
14 To perform the concept of function and procedure 4
Write a PL/SQL block to update the salary of employee specified by empid. If record exist
then update the salary otherwise display appropriate message. Write a function as well as
procedure for updating salary.
Write a PL/SQL block that will accept the employee code, amount and operation. Based on
specified operation amount is added or deducted from salary of said employee. Use user
defined exception handler for handling the exception.
16 To perform the concept of package 2
Create and invoke a package that contains private and public constructs.
18 To create, modify, delete, execute and recompile a stored procedure in SQL Server/ 4
MySQL