70. Examples - 3

Delete, Commit, Rollback and Renaming A Table

1. Delete all salesman from the salesman_mast whose salaries are equal to
   Rs.2000.
Q. delete from salesman_mast where sal_amount=2000;

2. Write a query to undo the above delete query.
Q. rollback;

3. Delete all products from product_mast where the Qty_Available is equal to
   100.
Q. delete from product_mast where qty_available=100 ;

4. Write a query such that the above query cannot be undone.
Q. commit;

5. Delete from client_mast where the state venue is "Illinois".
Q. delete from client_mast where state='Illinois';

6. Delete all employees from employee where basic_sal is less than 2000.
Q. delete from employee where basic_sal<2000 br="">
7. Write a query to mark the above two queries such that the first delete
   operation is undo
Q. savepoint d1;
   delete from client_mast where state='Illinois';
   rollback to d1;

8. Delete employee from the employee table where basic_sal is equal to
   Rs.3000 and job='clerk'.
Q. delete from employee where basic_sal=3000 and job='Clerk';

9. Delete employee from the employee table where job='clerk' or manager.
Q. delete from employee where job='Clerk' or job='Manager';

10. Delete all records from depttable table.
Q.  delete from depttable;

11. Delete all managers and salesman with salary over 1500 from employee
    table.
Q.  delete from employee where job='Manager' or
                          job='salesman' and basic_sal>1500;

12. Delete all employee name, job and department number of everyone whose
    name fall in the alphabetical range 'C' to 'L' from employee table.
Q.

13. Write a query so the the following statement can be delivered 'Kim is
    working as manager since 15-12-2002'  where employee number is E0001.
Q.  select ename || ' is working as ' || job ||'since'
    || hiredate from employee where ename='Kim';

14. Rename the table name from client_mast to T_client_mast.
Q.  rename client_mast to T_client_mast;

15. Write a query the column name 'name' should be displayed as employee name
    from the employee table.

Q.  select ename as "Name" from employee;

No comments:

Post a Comment