FOR FREE YEAR SOLVED

SQL ASSINGMENT 8 WITH SOLUTION

Back to Programming

Description

Create a table Employee and the details are



a)     Display the rows whose salary ranges from 15000 to 30000.

 

b)     Calculate the total and average salary amount of the Employee table.

 

c)     Count the total records in the Employee table.

 

d)     Determine the max and min salary and rename the column as max_salary and min_salary.

 

e)     Display all employee names and salary where salary is greater than minimum salary of the company and job title starts with ‘M’.

 

f)      Display DEPT_NO from the table employee avoiding duplicate values.




CREATE Table EMPLOYEE:

CREATE TABLE EMPLOYEE (

EMPNONUMBER(6) PRIMARY KEY,

ENAME VARCHAR2(10) NOT NULL,

JOB VARCHAR2(10) CHECK (JOB IN(‘S’,’M’,’T’)),

SAL NUMBER(7,2) CHECK(SAL>7000); 


 

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