Beruflich Dokumente
Kultur Dokumente
Ans)SQL> CREATE TABLE EMPLOYEE ( EMP_ID integer primary key, NAME varchar(50), DEPT_N
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
Queries: 1. Find the sum of all salaries in the organization.
Ans)35000
SUM(SALARY)
-----------
Ans)
DEPT_NAME SUM(SALARY)
'biology' ,6000);
'physics', 7000
Cse 9000
Cse 5000
english 8000
Ans)
SUM(SALARY)
-----------
14000
Ans)
AVG(SALARY)
-----------
7000
Ans)
MIN(SALARY)
-----------
5000
Ans)
MAX(SALARY)
-----------
9000
DEPT_NAME COUNT(*)
------------------------------ ----------
cse 2
physics 1
biology 1
English 1
8. Find the employees who have the salary less than 20000.
Ans)
In the above created table all the values are less than 20000
9. Sort the relation with respect to dept_name in ascending order and salary in desc order
within the dept.
Ans)
EMP_ID NAME
---------- --------------------------------------------------
DEPT_NAME SALARY
------------------------------ ----------
harikrishna 5000
'prudhvi' ,6000);
'sravan', 7000
adithya 8000
saikalyan 9000
Ans)
EMP_ID NAME
---------- --------------------------------------------------
DEPT_NAME SALARY
------------------------------ ----------
101 prudhvi
biology 6000
Ans)
EMP_ID NAME
---------- --------------------------------------------------
DEPT_NAME SALARY
------------------------------ ----------
105 adithya
english 8000
12.Select the content of the "NAME" and "SALARY" columns from employee table, and convert
the "NAME" column to uppercase.
Ans)
NAME SALARY
-------------------------------------------------- ----------
PRUDHVI 6000
SRAVAN 7000
HARIKISHNA 5000
ADITHYA 8000
13.Select the content of the "NAME" and "SALARY" columns from employee table, and convert
the "NAME" column to lowercase.
Ans)
prudhvi 6000
sravan 7000
saikalyan 9000
harikrishna 5000
adithya 8000
NAME SALARY
-------------------------------------------------- ----------
14.Select the length of the values in the "DEPT_NAME" column from employee table.
Ans)
LENGTH(DEPT_NAME)
-----------------
15. List the departments in which the average salary of the employees is greater than 50,000.
Ans)
As per the created table the salary are less than 50000