Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

PRACTICAL 5

1. List total deposit from deposit.


ANS: SELECT SUM(AMOUNT) FROM DEPOSIT_540;

2. List total loan from karolbagh branch.


ANS: SELECT SUM(AMOUNT) FROM DEPOSIT_540 WHERE BNAME='KAROLBAGH';

3. Give maximum loan from branch vrce.


ANS: SELECT MAX(AMOUNT) FROM BORROW_540 WHERE BNAME='VRCE';

4. Count total number of customers.


ANS: SELECT COUNT(CNAME) FROM CUSTOMERS_540;

5. Count total number of customer’s cities.


ANS: SELECT COUNT(DISTINCT CITY) FROM CUSTOMERS_540;

6. Create table supplier from employee with all the columns.

ANS: CREATE TABLE SUPPLIER_540 AS SELECT * FROM EMPLOYEE_540;

SELECT * FROM SUPPLIER_540;


Create table sup1 from employee with first two
7.

columns.
ANS: CREATE TABLE SUP1_540 AS SELECT EMO_NO,EMP_NAME FROM EMPLOYEE_540;

SELECT * FROM SUP1_540;

8. Create table sup2 from employee with no data


ANS: CREATE TABLE SUP2_540 AS SELECT * FROM EMPLOYEE_540 WHERE 1=2;

SELECT * FROM SUP2_540;

. Insert the data into sup2 from employee whose second


9

character should be ‘n’ and string


should be 5 characters long in employee name field.
ANS: INSERT INTO SUP2_540 SELECT * FROM EMPLOYEE_540 WHERE EMP_NAME LIKE '_N___';

SELECT * FROM SUP2_540;


10 . Delete all the rows from sup1.
ANS: DELETE FROM SUP1_540;

SELECT * FROM SUP1_540;

11. Delete the detail of supplier whose sup_no is 103.


ANS: DELETE FROM SUPPLIER_540 WHERE EMO_NO = 103;

SELECT * FROM SUPPLIER_540;

12 . Rename the table sup2.


ANS: RENAME SUP2_540 TO CHANDLER_BING;

13 . Destroy table sup1 with all the data.


ANS: DROP TABLE SUP1_540;

Update the value dept_no to 10 where second


14.

character of emp. name is ‘m’.


ANS: UPDATE EMPLOYEE_540 SET DEPT_NO = 10 WHERE EMP_NAME LIKE '_M%';
Update the value of employee name whose employee
15.

number is 103.
ANS: UPDATE EMPLOYEE_540 SET EMP_NAME = 'JENNY' WHERE EMO_NO = 103;

COMMIT;

You might also like