Equals To
Anonymous contributor
Published Aug 29, 2024
Contribute to Docs
The EQUAL TO
operator is used to compare the equality of two expressions, used with the WHERE
clause.
Syntax
SELECT column1, column2, ...
FROM table_name
WHERE column1 = condition;
The equal to operator =
can be combined with other comparison operators to check for the following:
>=
: Greater than or equal to<=
: Less than or equal to!=
: Not equal
Example
Return employees that have employee IDs equal to 100 in the table Employ
:
# Create a table named 'employ'CREATE TABLE employ (employ_name VARCHAR(30), employ_id INT PRIMARY KEY);# Insert some stocks into the tableINSERT INTO employ (employ_name, employ_id) VALUES('John', 100),('Janet', 101),('Joe', 102)# Use the EQUAL TO operator to find employees with a specific IDSELECT employ_name, employ_id FROM employ WHERE employ_id = '100';
The query results with the following result:
employ_name, employ_id'John', 100
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SQL on Codecademy
- Skill path
Analyze Data with SQL
Learn to analyze data with SQL and prepare for technical interviews.Includes 9 CoursesWith CertificateBeginner Friendly17 hours - Skill path
Design Databases With PostgreSQL
Learn how to query SQL databases and design relational databases to efficiently store large quantities of data.Includes 5 CoursesWith CertificateBeginner Friendly13 hours - Free course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner Friendly5 hours