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

Question -1: create the following table

column name type width


Emp_code N 5
Emp_name C 10
Designation C 15
Basic N 5
Dep_code N 5
Question -2: enter 10 records
Question -3: list the employee name and dept. code from table
Question -4: list the name of employee working in department 27
Question -5: list name of the employee not belonging to department 10 and 30
Question -6:list name of those employee whose name start with s or end with s
Question -7: list the different position available in department table
Question -8:list name , salary , pf of employee
Question -1: create the following table
SQL> create table EMPLOYEE(Emp_code NUMBER(5),Emp_name VARCHAR2(10),Designation
VARCHAR2(15),Basic NUMBER(5),Dep_code NUMBER(5));
Table created.
SQL> desc EMPLOYEE
Name Null? Type
----------------------------------------- -------- ----------------------------
EMP_CODE NUMBER(5)
EMP_NAME VARCHAR2(10)
DESIGNATION VARCHAR2(15)
BASIC NUMBER(5)
DEP_CODE NUMBER(5)

Question -2: enter 10 records


SQL> insert into EMPLOYEE values(1001,'Raju','ACCOUNT',26000,11);
1 row created.
SQL> insert into EMPLOYEE values(1002,'Soumen','ACCOUNt',28000,13);
1 row created.
SQL> insert into EMPLOYEE values(1003,'Subhasish','MANAGER',31000,10);
1 row created.
SQL> insert into EMPLOYEE values(1004,'Megha','PEON',21000,21);
1 row created.
SQL> insert into EMPLOYEE values(1005,'Sudip','CLEARK',25000,27);
1 row created.
SQL> insert into EMPLOYEE values(1006,'Manisha','ASSIT_MANAGER',28000,35);
1 row created.
SQL> insert into EMPLOYEE values(1007,'Gobinda','SUPERVISOR',18000,25);
1 row created.
SQL> insert into EMPLOYEE values(1008,'Srijit','SUPERVISOR',15000,23);
1 row created.
SQL> insert into EMPLOYEE values(1009,'Sourav','PROJCT_MANAGER',27000,30);
1 row created.
SQL> insert into EMPLOYEE values(10010,'Pranab','PROJCT_MANAGER',29500,29);
1 row created.
SQL> SELECT * from EMPLOYEE;
EMP_CODE EMP_NAME DESIGNATION BASIC DEP_CODE
10001 Raju ACCOUNT 26000 11
10002 Soumen ACCOUNT 28000 13
10003 Subhasish MANAGER 31000 10
10004 Megha PEON 21000 21
10005 Sudip CLEARK 25000 27
10006 Manisha ASSIT_MANAGER 28000 35
10007 Gobinda SUPERVISOR 18000 25
10008 Srijit SUPERVISOR 15000 23
10009 Sourav PROJCT_MANAGER 27000 30
100010 Pranab PROJCT_MANAGER 29500 29
10 rows selected.

Question -3: list the employee name and dept. code from table
SQL> SELECT Emp_name,dep_code from EMPLOYEE;
EMP_NAME DEP_CODE
Raju 11
Soumen 13
Subhasish 10
Megha 21
Sudip 27
Manisha 35
Gobinda 25
Srijit 23
Sourav 30
Pranab 29
10 rows selected.

Question -4: list the name of employee working in department 27


SQL> SELECT Emp_name ,dep_code from EMPLOYEE where Dep_code=27;
EMP_NAME DEP_CODE
Sudip 27

Question -5: list name of the employee not belonging to department 10 and 30
SQL> SELECT Emp_name ,dep_code from EMPLOYEE where Dep_code not IN(10,30);
EMP_NAME DEP_CODE
Raju 11
Soumen 13
Megha 21
Sudip 27
Manisha 35
Gobinda 25
Srijit 23
Pranab 29
8 rows selected.

Question -6:list name of those employee whose name start with s or end with s
SQL> SELECT EMP_name from EMPLOYEE where Emp_name like ('S%') or Emp_name like ('%s');
EMP_NAME
----------
Soumen
Subhasish
Sudip
Srijit
Sourav
Question -7: list the different position available in department table
SQL> SELECT distinct Designation from EMPLOYEE;
DESIGNATION
---------------
MANAGER
SUPERVISOR
PROJCT_MANAGER
ACCOUNT
ASSIT_MANAGER
CLEARK
PEON
7 rows selected

Question -8:list name , salary , pf of employee


SQL> SELECT Emp_name,Basic,(Basic+Basic*0.1) "PF" from EMPLOYEE;
EMP_NAME BASIC PF
---------- ---------- ----------
Raju 26000 28600
Soumen 28000 30800
Subhasish 31000 31000
Megha 21000 23100
Sudip 25000 27500
Manisha 28000 30800
Gobinda 18000 19800
Srijit 15000 16500
Sourav 27000 29700
Pranab 29500 32450
10 rows selected.
SQL> spool off

You might also like