= (Equals) Operator - SQL
Overview
The = (Equals) Operator in SQL is used to assign a value to a variable or to specify a condition that checks for equality in a WHERE clause.
Assignment in Variable Declaration
Syntax:
DECLARE @variable_name datatype;
SET @variable_name = value;
DECLARE @variable_name datatype
declares a variable with a specified data type.
SET @variable_name = value
assigns a value to the declared variable.
Equality check in a WHERE statement
Syntax:
SELECT column1, column2
FROM table_name
WHERE column1 = value
SELECT column1, column2, ... FROM table_name
specifies the columns to select from a table.
WHERE column1 = value
filters the rows where column1
is equal to the specified value.