Databaselab - Cse37
Databaselab - Cse37
ASSIGNMENT-1
i) DEPOSIT(roll number)
iv)BORROW(roll number)
LOANNO CNAME BNAME AMOUNT
201 ANIL VRCE 1000.00
206 RAHUL AJNI 5000.00
311 SUNIL DHARAMPETH 3000.00
321 MADHURI ANDHERI 2000.00
375 PRAMOD VIHAR 8000.00
2
ASSIGNMENT-2
3
ASSIGNMENT-3
1. Update the amount of all depositors in deposit table by giving them 10% interest (i.e. amount=amount
* 0.1) where branch is VRCE.
2. Update the amount of all depositors in deposit table by giving them 10% interest where branch is
VRCE and customer name ANIL.
3. Create table STUDENT and insert the following data :-
4
ASSIGNMENT-4
1. Calculate 10*10.
2. Display system date.
3. Calculate the absolute value of -20.
4. Calculate 10^10.
5. Calculate square root of 25.
6. Round the value 23.565 to one places of decimal.
7. Display ‘TRIDENT’ in lowercase.
8. Display ‘trident’ in uppercase.
9. Display the first letter of your name in uppercase.
10. Calculate the length of your name.
11. Write a query that would return a string like “ORA” , if the string inputted is ‘ORACLE’.
12. Find the character position of ‘C’ in the string ‘ORACLE’.
‘ORACLE
13. Delete the extra spaces from the strings ‘ ORACLE’ and ‘ORACLE
14. Write a query that would display **ORACLE, if the string inputted is ORACLE.
15. Same as question 14 but the output is ORACLE**.
16. Retrieve the last month specified in system date.
17. Retrieve number of months between 01-01-07 to 01-05-07.
18. Round 56.23 using negative numbers(e.g.-1,-2, and-3)
19. Find out the remainder of the division 1600/300.
20. Find the maximum and minimum number from a list of numbers.
5
ASSIGNMENT-5
5. . Create a table called SALESORDERDETALS with its primary key as DORDERNO. The foreign
key is ORDERNO of the table SALESORDER referencing to the column DORDERNO in the table
SALESORDERDETAILS in table level concept.
6
6. Apply on delete cascade..
8. Add a primary key constraint on the column FNAME of the table EMPLOYEE.
9. Add a foreign key on the column ORDERNO belonging to the table SALESORDER10 which refers
to the table SALESORDERDETAILS. Modify column PRODUCTNO to include UNIQUE constraint.
11. Drop the foreign key constraint on the column CLIENTNO in the table SALESORDER10.
SALESORDER10 table
7
Assignment-6
Sub-query
1. List all the depositors having deposit in all the branches where SUNIL is having branch.
2. Retrive the account and amount of all the depositors living in city NAGPUR.
3. List the cities of depositors having branch as ‘KAROLBAGH’.
4. List all the cities where branches of Anil & Sunil are located.
5. List all the customer Name,Amount of depositors living in city where Anil or Sunil is living.
View
Emp_Company
ENAME CNAME SALARY JDATE
ANIL ACC 1500 01-MAY-89
SANKAR TATA 2000 10-JUL-90
JAYA CMC 1800 07-JUN-91
SUNIL CMC 1700 01-JAN-88
VIJAY TATA 5000 03-JAN-88
6. Create a view foe retrieving company name its average salary, maximum salary & minimum salary.
7. Create a view called Emp_Company_Details from Emp_Company that includes all the attributes of
Emp_Company.
10. Update the content of SALARY to 10000 in the view called Emp_ompany_Details where ENAME
is Prakash.
11. Delete the record from the view Emp_Company_Details where ENAME is Prakash.
Self-Join
Insert the following date into the table Employee
ENAME CITY
ANIL NAGPUR
SANKAR BOMBAY
JAYA MADRAS
SUNIL BOMBAY
VIJAY DELHI
PRAKASH CALCUTTA
AJAY MADRAS
8
12. List the employee living in the same city where SUNIL is living.
13. From the following table retrive the name of employee & the name of respective manger
EMPOYEE Table
EMPNO NAME MGRNO
10 ASHOK 11
11 RAVI 12
12 SUMIT 13
Equi-Join
14. Retrive the name of customers from deposit table having the living city same as their branch city.
15. Retrive the name of borrowers havin deposit amount greater than 1000 and loan amount greater than
2000.
16. Retrive the name of customer having living city BOMBAY and branch city NAGPUR.
18. Retrive the loanNo, Loan amount, account no, deposit amount of customers living in city Nagpur.
9
Assignment-7
1. Create an English sentence by joining string values with column data retrieved
from the deposit table i.e
Print customer {cname} having accountno {actno} in branch {bname} has deposited
{amount}on {adate} from deposit table.
2. Print Borrow {cname} having accountno [loanno} has taken{amount}loan from {bname}
from borrow table.
5. 5.Retrived the deposit information table actno, cname, bname, amount for all the deposits
placed by the customer in ascending order of adate . The adate should be displayed in
‘DD/MM/YY’ format.
10. 10.Retrive the name of employee which is common to both the company ‘ACC’ and ‘TATA’.
11. Retrive the name of employee where ‘ACC’ is located but not ‘TATA’.
12. 12.list all the customers who are deposited but not borrowers.
13. List all the customers who are deposited and borrowers.
10
ASSIGNMENT-8
4.Use the above sequence SQ to insert values into actno column of above created view.
8.Create a simple index on BNAME column accepting duplicate values for DEPOSIT table.
9. Create an simple index on ACTNO column not accepting duplicate values for DEPOSIT
table.
10.Create an composite index on CNAME, BNAME allowing duplicate values for BORROW
table.
11. Create an composite index on LOANNO, BNAME not allowing duplicate values for
BORROW table.
11
16. Update the amount of all depositors in the synonym DEPO_SYN by giving them 10%
interest where branch is AJNI
17.Delete all rows from the synonym DEPO_SYN where branch is VRCE.
20. Delete the first three records from DEPOSIT table using ROWNUM.
Assignment – 9
1. Write a PL/SQL block that accept an integer value and prints that value.
2. Write a PL/SQL block to calculate the area of a triangle by accepting the base and
height.
2. 3. Write a PL/SQL block to calculate the area of a rectangle, store the length, breadth
and the corresponding value of the calculated area in the table called rectarea.
3. Write a PL/SQL block to calculate the area of a circle for a value of radius varying from
r=2 to r=5.
6. Write a PL/SQL statement to add odd numbers and multiply even number between 1-
50.
12
ASSIGNMENT- 10
13