Sunday, 11 June 2017

DBMS Tutorial-3


To Perform various data manipulation commands, aggregate functions and sorting concept on all created tables in previous tutorial.

Queries

  1. List total deposit from deposit.

    • select sum(amount)from deposit_gtu;
  2. List total loan from karolbagh branch

    • select sum(amount) from deposit_gtu where bname='Andheri';
  3. Give maximum loan from branch vrce.

    • select max(amount) from borrow_gtu where bname='VRCE';
  4. Count total number of customers.

    • select count(cname) from customers;
  5. Count total number of customer’s cities.

    • select count(DISTINCT city) from customers;
  6. Create table supplier from employee with all the columns.

    • create table supplier as select * from employee;
  7. Create table sup1 from employee with first two columns.

    • create table sup1 as (select * from employee WHERE EMP_NO<103 );
  8. Create table sup2 from employee with no data.

    • create table sup2 as select * from employee WHERE 1=2;
  9. Insert the data into sup2 from employee whose second character should be ‘n’ and string should be 5 characters long in employee name field.

    • INSERT INTO sup2 SELECT * FROM employee where emp_name like '_n___';
  10. Delete all the rows from sup1.

    • delete from sup1;
  11. Delete the detail of supplier whose sup_no is 103.

    • delete from supplier where emp_no=103;
Share:

2 comments: