SQLQuery 2024
SQLQuery 2024
SQLQuery 2024
GO
DATEDIFF(Interval,value,date1,date2)
SELECT CONVERT(VARCHAR(19),GETDATE())
SELECT CONVERT(VARCHAR(19),GETDATE(),110) --- 03-11-2024
SELECT CONVERT(VARCHAR(19),GETDATE(),20) --- 2024-03-11 14:24:03
SELECT CONVERT(VARCHAR(19),GETDATE(),105) --- 11-03-2024
---------
SELECT CONVERT(VARCHAR(19),1234564)
---------
-- Create a query to display the total number of employees and, of that total,
-- the number of employees hired in 2001 .. 2008 .
-- Create appropriate column headings
--- Display the last_name, the year that the employees started.
TOTAL 2001 2002 2003 2004
---------- ---------- ---------- ---------- ----------
251 76 74 74 27
Create OR ALTER function circle_area which returns the area of a circle with a
radius r.
CREATE OR ALTER FUNCTION circle_area(@radius float)
RETURNS float
AS
BEGIN
DECLARE @PI float=3.14,@AREA float;
SET @AREA=@RADIUS*@RADIUS*@PI;
RETURN @AREA;
END;
SELECT DBO.circle_area(10)
DECLARE @r FLOAT
SET @r=100
PRINT(DBO.circle_area(@r))
------
Write a TSQL Program which displays the first_name, last_name, Salary,city
and country of one employee_id.
Display the output as shown below .
Employee ID : 176
First Name : Verney Last Name : Gravenell
Salary : 21000
City : New York Country : United States
--- LOOP
while condition
BEGIN
TSQL_statement|BREAK;
END;
END;
ELSE
BEGIN
END;
Display the total even and total odd for integer less than 11