0% found this document useful (0 votes)
571 views6 pages

Practical 5: 1. List Total Deposit From Deposit

The document contains SQL queries to: 1) Summarize totals from deposit and loan tables and find maximum loan amount. 2) Count total customers and unique customer cities. 3) Create new tables from an employee table and insert/delete/update data. 4) Rename one table and drop another table permanently.

Uploaded by

Jenny Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
571 views6 pages

Practical 5: 1. List Total Deposit From Deposit

The document contains SQL queries to: 1) Summarize totals from deposit and loan tables and find maximum loan amount. 2) Count total customers and unique customer cities. 3) Create new tables from an employee table and insert/delete/update data. 4) Rename one table and drop another table permanently.

Uploaded by

Jenny Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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