Professional Documents
Culture Documents
Aim: Population of The Database by Using Inbuilt Function in SQL
Aim: Population of The Database by Using Inbuilt Function in SQL
Q.1. Display all the details of the records whose employee name starts with A.
Ans:
Query:
select *
from EMP22
output:
NAME: Deepak Maurya
CLASS: SE-IT ROLL NO.22
Q.2. Display all the details of the records whose employee name does not starts with A.
Ans:
Query:
select *
from EMP22
output:
Q.3. Display the rows whose salary ranges from 15,000 to 30,000.
Ans:
Query:
select *
from EMP22
output:
NAME: Deepak Maurya
CLASS: SE-IT ROLL NO.22
Q.4. Calculate the total and average salary amount of the employee table.
Ans:
Query:
select avg(sal)
from EMP22
output:
Query:
select sum(sal)
from EMP22
output:
NAME: Deepak Maurya
CLASS: SE-IT ROLL NO.22
Ans:
Query:
select count(*)
from EMP22
output:
Q.6.Determine the max and min salary and rename the column as max_salary and min_salary.
Ans:
Query:
select max(sal)
NAME: Deepak Maurya
CLASS: SE-IT ROLL NO.22
from EMP22
output:
Query:
select min(sal)
from EMP22
output:
Query:
NAME: Deepak Maurya
CLASS: SE-IT ROLL NO.22
from EMP22
Output:
Ans:
Query:
select months_between
(to_date('08-02-2010','mm-dd-yyyy'),
to_date('06-02-2010','mm-dd-yyyy')) as months
from dual;
output:
Query:
NAME: Deepak Maurya
CLASS: SE-IT ROLL NO.22
select months_between('01-aug-2010','01-jun-2010')
from dual;
output:
Ans:
Query:
select last_day('01-sep-2017')
from dual;
output:
Q.9. Find how many job titles are available in employee table with and without duplication.
NAME: Deepak Maurya
CLASS: SE-IT ROLL NO.22
Ans:
select count(job)
from EMP22
output:
from EMP22
Output:
NAME: Deepak Maurya
CLASS: SE-IT ROLL NO.22