create table Employee
(
EmpId int not null primary key,
FirstName varchar(50),
LastName varchar(50),
DeptId int,
Job varchar(50),
sal money
)
insert into Employee(EmpId,FirstName,LastName,DeptId,Job,sal)values(1001,'mithilesh','kumar',1,'hr',14000)
insert into Employee(EmpId,FirstName,LastName,DeptId,Job,sal)values(1002,'nirbhaya','kumar',2,'hr',30000)
insert into Employee(EmpId,FirstName,LastName,DeptId,Job,sal)values(1003,'rakesh','kumar',3,'account',64000)
insert into Employee(EmpId,FirstName,LastName,DeptId,Job,sal)values(1004,'rohit','kumar',4,'account',70000)
insert into Employee(EmpId,FirstName,LastName,DeptId,Job,sal)values(1005,'vikas','kumar',5,'clerk',4000)
insert into Employee(EmpId,FirstName,LastName,DeptId,Job,sal)values(1006,'rajenndra','kumar',6,'clerk',3000)
select * from Employee
select job, MAX(sal) job from
Employee group
by Job
Output:
No comments:
Post a Comment