Sample DML Query in SQL Server
select
* from employee
delete
from employee where
EmpID=16
truncate
table employee
truncate
table employee
insert
into employee values('prkul','Dhrbhanga','919874653231','55423','abc','40')
select
* from employee
where empID=13
//create table
Emp(EmpName,Address,PhNo,Salary,DeptID) as select EmpName,Address,PhNo,Salary,DeptID from employee
select
distinct * from employee where
deptname='MCA'
select
distinct(deptname) from employee
select
* from employee
order by
address
select
* from employee
order by
address desc
insert
into emp1 select
empname,address,phno,salary,deptname,deptid from employee
where deptid like
'%20%'
select
* from emp1
*2nd Max Salary
select
max(salary)'salary' from employee where
salary < (select max(salary) from employee)
select
max(salary)'Salary' from employee
select
max(salary)"Pradeep" from
employee
*3rd Max Salary
select
max(salary)'Salary' from employee where
salary < (select max(salary) from employee where
salary < (select max(salary) from employee))
update
employee set deptname='B.Tech' where
deptname='abc'
update
employee set salary=9000000
where empid=20
*4th Max Salary
select
max(salary)'Salary' from employee where
salary < (select max(salary) from employee where
salary < (select max(salary) from employee where
salary < (select max(salary) from employee)))
*5th Max Salary
select
max(salary)'Salary' from employee where
salary < (select max(salary) from employee where
salary < (select max(salary) from employee where
salary < (select max(salary) from employee where
salary < (select max(salary) from employee))))
0 comments
Post a Comment