CREATE OWN LIBRARY

SQL ASSINGMENT 7 WITH SOLUTION

Back to Programming

Description

Employee (EMPNO, NUMBER(6) PK, ENAME VARCHAR2(10) NOT NULL, JOB VARCHAR2(10), DEPTNO NUMBER(3), SAL NUMBER (7, 2))

 

 

a)     List the records in the Employee table orderly salary in descending order.

 

b)     Display only those employees whose DEPTNO is 30.

 

c)     Display DEPTNO from the table employee avoiding the duplicated values.

 

d)     Display all the details of the records whose employee name starts with ‘A’.

 

e)     Display all the details of the records whose employee name does not starts with ‘A’.

 

f)      Display the names of those whose salary is not between 15000 to 30000.



CREATE Table EMPLOYEE: 

CREATE TABLE EMPLOYEE (

EMPNO

NUMBER(6) PRIMARY KEY,

ENAME VARCHAR2(10) NOT NULL,

JOB VARCHAR2(10),DEPTNO NUMBER(3),

SAL NUMBER(7,2)); 


 

Table EMPLOYEE is created.



Insert the values in the table EMPLOYEE:

INSERT INTO Employee VALUES(101, 'RAM', ‘STAFF’,10,15000)

INSERT INTO Employee VALUES(103, 'MADHU', ‘STAFF’,20,20000)

INSERT INTO Employee VALUES(104, 'SHYAM', ‘MANAGER’,20,35000)

INSERT INTO Employee VALUES(102, 'AMAL', ‘TECHNICIAN’,10,40000)INTO Employee VALUES(106, 'JONES', ‘STAFF’,30,10000);



Output:

5 rows created

Code