You are on page 1of 1

SELECT *FROM employee

use [58708_1]

Alter table employee


Add
id_employee int identity (1,1),
age int,
constraint pk_employee primary key (id_employee)

SELECT YEAR ( '2013-02-12' ) as year,


MONTH( '2013-02-12' ) as month,
DAY ( '2013-02-12' ) as day

SELECT SYSDATETIME(),
SYSDATETIMEOFFSET(),
GETDATE(),
GETUTCDATE()

select DATEDIFF (year,BirthDate, getdate()) as age from employee

update employee set age=DATEDIFF (year,BirthDate,getdate())

SELECT MAX (age) AS Oldest_Person


FROM employee

SELECT MIN (age) AS Youngest_Person


FROM employee

select count(*) as no, age from employee group by age

SELECT TOP 10 * INTO OLD_EMPLOYEE FROM employee ORDER BY Birthdate


SELECT * FROM OLD_EMPLOYEE

You might also like