0% found this document useful (0 votes)
14 views5 pages

Dbms 4

this document includes creation of database using my sql and its variety.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Dbms 4

this document includes creation of database using my sql and its variety.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Shwetank Pandey, 2301420042 , b.

tech cse
select * from employee as e
inner join departement as d
on e.deptno = d.deptno;

select e.ename, d.dname from employee as e


inner join departement as d
on e.deptno = d.deptno;

create table employeedetail(empno int(4) ,phoneno int


,loaction varchar(100),
foreign key(empno) references employee(empno));
select * from employeedetail;
drop table employeedetail;
insert into employeedetail values(
(7654, 80979, 'sector88'),
(7698, 90687, 'sector16'),
(7782, 80978, 'sohan'),
(7788, 67565, 'huda'));
-------------=----------

select sal
from employee
where empno= 7876;

select ename,job ,sal


from employee where sal <(select sal
from employee where empno = 7876);

select * from departement;

select ename, sal from employee


where sal in (select min(sal) from employee group by
Deptno);

select ename , sal from employee


where sal > any (select max(sal) from employee group
by Deptno);

select empno ,ename , job ,sal from employee


where sal <all (select sal from employee where
job="manager");

select ename , job, sal , empno from employee;

select * from employee where sal > (select avg(sal) from


employee);
select * from employee where departement in (select *
from employee where ename ="jones");

select ename from employee where ename not in


(select mgr from employee where mgr is not null);

SELECT empno, ename


FROM employee
WHERE job = 'CLERK'
ORDER BY sal DESC;

SELECT ename
FROM employee
WHERE job = 'SALESMAN'
AND sal > (SELECT MAX(sal) FROM employee
WHERE job = 'CLERK');

SELECT ename
FROM employee
WHERE job = 'CLERK'
AND sal > (SELECT MIN(sal) FROM employee WHERE
job = 'SALESMAN');
select * from employee;

SELECT * FROM employee WHERE job =


'SALESMAN';

SELECT * FROM employee WHERE sal > 2000;

SELECT * FROM employee ORDER BY sal DESC


LIMIT 1;

SELECT * FROM employee WHERE hiredata > '1982-


01-01';

SELECT SUM(sal) AS sal FROM employee;

SELECT AVG(sal) AS average_salary FROM employee


WHERE Deptno = 30;

SELECT * FROM employee WHERE mgr IS NULL;

SELECT * FROM employee ORDER BY hiredate DESC


LIMIT 1;
SELECT * FROM employee WHERE Deptno = 20
ORDER BY sal DESC;

SELECT * FROM employee WHERE comm IS NOT


NULL;

SELECT count(empno) AS empno


FROM employee
GROUP BY Deptno;

SELECT empno, ename, sal


FROM employee
JOIN employee ON mgr = m.employee_id
WHERE e.salary > m.salary;

You might also like