SQL Sci Pract
SQL Sci Pract
SQL Sci Pract
1. Enter 10 records for employee table and 4 records for department table.
2. List all employees who work for accounts department.
3. How many employees work for accounts department?
4. What is the minimum, maximum and average salary of employees
working for accounts department?
5. List all employees working for a particular supervisor.
6. Retrieve the department names for each department where only one
employee work.
7. Increase the salary for all the employees in the sales department by 15%.
8. Add a new column to the employee table – bonus number (5) and
compute 5% of salary to the said field.
9. Delete all the employees in the marketing department.
CREATING EMPLOYEE TABLE
********************************
CREATE A DATABASE FOR THE BANK TRANSACTION.
BANK TABLE
FIELD NAME FIELD TYPE DESCRIPTION
ACC_NO NUMBER(4) CUSTOMER A/C NO.
CUST_NAME VARCHAR2(20)CUSTOMER NAME
TRANS_AMT NUMBER(8,2) TRANSACTION AMOUNT
TRANS_DATE DATE TRANSACTION DATE
TRANS_TYPE CHAR(10) „D‟ FOR DEPOSIT
„W‟ FOR WITHDRAW
CUSTOMER TABLE
FIELD NAME FIELD TYPE
ACC_NO NUMBER(4)
CUST_NAME VARCHAR2(20)
ADDRESS VARCHAR2(20)
PHONE NUMBER(12)
1. INSERT DATA (10 RECORDS) INTO BANK AND CUSTOMER TABLE.
2. DISPLAY ALL RECORDS FROM BANK & CUSTOMER TABLE.
3. DISPLAY ALL RECORDS FROM BANK FOR A PARTICULAR DATE.
4. JOIN BANK AND CUSTOMER TABLE.
5. DISPLAY COUNT OF ALL RECORDS AND THEIR CORRESPONDING
TRANSACTION GROUP BY TRANSACTION TYPE.
6. DISPLAY ALL RECORDS FROM CUSTOMER ORDER BY CUSTOMER NAME
IN DESCENDING ORDER.
7. CHANGE THE TRANSA CTION AMOUNT.
8. ALTER THE TABLE CUSTOMER TO CHANGE THE SIZE OF CUSTOMER
ADDRESS.
9. DELETE RECORDS FROM BANK HAVING A PARTICULAR ACCOUNT
NUMBER.
10. CREATE A TABLE CONTAINING CUSTOMER ACCOUNT NUMBER RANGE.
11. DISPLAY ALL CUSTOMERS WHOSE NAME STARTS WITH „G‟
12. DISPLAY TODAY‟S DATE.
13. DISPLAY TOTAL TRANSACTION AMOUNT FROM BANK TABLE.
14. CREATE VIEW ON CUSTOMER SHOWING CUSTOMERS NUMBER AND
PHONE NUMBER.
15. DISPLAY DISTINCT CUSTOMER NUMBERS FROM BANK.
16. DISPLAY ACCOUNT NUMBER FROM BANK WHO HAVE MORE THAN ONE
TRANSACTION.
17. DISPLAY ALL RECORDS FROM CUSTOMER WHOSE PHONE NUMBER IS
NULL.
18. DELETE ALL RECORDS FROM CUSTOMER TABLE.
19. DROP BANK TABLE.
20. DROP CUSTOMER TABLE.
COMMAND TO CREATE CUSTOMER TABLE
******************************