How To Display 1 To 100 Numbers With Query?: Cte 1 Number Number 1 Cte Number 100 Cte
How To Display 1 To 100 Numbers With Query?: Cte 1 Number Number 1 Cte Number 100 Cte
How To Display 1 To 100 Numbers With Query?: Cte 1 Number Number 1 Cte Number 100 Cte
with cte as
(
select 1 number
union all
select number + 1 from cte where number < 100
)
select * from cte
Write an SQL query to find the position of the alphabet (‘a’) in the first name column
‘Amitabh’ from the Worker table.
on employee
AFTER insert
as
begin
declare @id int
select @id = Id from inserted
insert into Employee_Audit_Test
values('New Employee with ID ' + CAST(@ID as Varchar(10)) + ' is added at ' +
CAST(GETDATE() AS VARCHAR (50)))
end
SELECT
salary
FROM employees
GROUP BY salary
HAVING COUNT(salary) >1;
SELECT * FROM (
SELECT
ROW_NUMBER() OVER (ORDER BY employee_id asc) AS rownumber,
employee_id
FROM employees
) AS foo
WHERE rownumber = 5
SELECT * FROM (
SELECT
ROW_NUMBER() OVER (ORDER BY employee_id asc) AS rownumber,
employee_id
FROM employees
) AS foo
WHERE rownumber %2 = 1
SELECT * FROM (
SELECT
ROW_NUMBER() OVER (ORDER BY employee_id asc) AS rownumber,
employee_id
FROM employees
) AS foo
WHERE rownumber %2 = 0
SELECT *
into employeesemp
FROM employees
or
SELECT
TOP 50 PERCENT Row_Number() over (order by employee_id) ,*
FROM
employees;
How to get distinct records from the table without using distinct keyword.
Select *
FROM Employees1
Where DATEDIFF(MONTH, HireDate, GETDATE()) Between 1 and 1
with emp_cte as
(select employeeid, employeename, managerid, 0 as emplevel
from tbEmployee where ManagerId is null
union all
select e.employeeid, e.employeename, e.managerid, emplevel + 1 as emplevel from
tbEmployee as e
inner join emp_cte as c on e.managerId= c.EmployeeId
)
select * from emp_cte
*
* *
* * *
* * * *