Relational Operators
Relational Operators
SELECT [EmployeeID]
,[Rate]
,[PayFrequency]
FROM [AdventureWorks].[HumanResources].[EmployeePayHistory]
WHERE Rate >15;
GO
=====================================================================
IF- ELSE
DECLARE @DateHired As datetime2,
@CurrentDate As datetime2
SET @DateHired = N'2010/10/04'
SET @CurrentDate = SYSDATETIME()
IF @DateHired < @CurrentDate
BEGIN
PRINT 'You have the experience required for a new promotion '
PRINT @DateHired
END
ELSE
PRINT 'You do not have the experience required for a new promotion '
GO
----------------------------------
-- Square Calculation
DECLARE @Side As Decimal(10,3),
@Perimeter As Decimal(10,3),
@Area As Decimal(10,3);
SET @Side = 48.126;
SET @Perimeter = @Side * 4;
SET @Area = @Side * @Side;
IF @Side IS NULL
PRINT N'A null value is not welcome'
ELSE IF @Side > 0
BEGIN
SELECT @Side AS Side;
SELECT @Perimeter AS Perimeter ;
SELECT @Area AS Area;
END;
ELSE
PRINT N'You must provide a positive value';
GO
=====================================================================
CASE WHEN THEN ELSE