The addition operator adds two numbers. It is used in SQL to calculate the sum of two numeric columns or expressions.
The subtraction operator subtracts one number from another. It is used to find the difference between two numeric columns or expressions.
The multiplication operator multiplies two numbers. It is used to calculate the product of two numeric columns or expressions.
The division operator divides one number by another. It is used to calculate the quotient of two numeric columns or expressions.
SELECT salary + bonus AS TotalIncome FROM employees;
SELECT price - discount AS SalePrice FROM products;
SELECT quantity * price AS TotalCost FROM sales;
SELECT total / count AS Average FROM statistics;
Arithmetic operations are crucial for financial calculations, statistical analysis, and inventory management in SQL databases.
Console Output:
TotalIncome: 75000
SalePrice: 299.99
TotalCost: 1500
Average: 500
The equal operator is used to compare two values and returns true if they are equal.
The not equal operator is used to compare two values and returns true if they are not equal.
The greater than operator is used to compare two values and returns true if the left operand is greater than the right operand.
The less than operator is used to compare two values and returns true if the left operand is less than the right operand.
SELECT * FROM employees WHERE salary = 50000;
SELECT * FROM products WHERE price <> 100;
SELECT * FROM orders WHERE quantity > 10;
SELECT * FROM customers WHERE age < 30;
Comparison operators are essential for filtering data, validating conditions, and performing queries based on specific criteria.
Console Output:
Employee: John Doe
Product: Widget A
Order: #12345
Customer: Jane Smith
The AND operator is used to combine multiple conditions in a SQL query and returns true if all conditions are true.
The OR operator is used to combine multiple conditions in a SQL query and returns true if at least one condition is true.
The NOT operator is used to negate a condition in a SQL query and returns true if the condition is false.
SELECT * FROM employees WHERE department = 'Sales' AND salary > 50000;
SELECT * FROM products WHERE category = 'Electronics' OR category = 'Appliances';
SELECT * FROM orders WHERE NOT status = 'Shipped';
Logical operators are vital for constructing complex queries that require multiple conditions to be checked simultaneously.
Console Output:
Employee: Alice Brown
Product: Laptop
Order: #67890
The IN operator allows you to specify multiple values in a WHERE clause. It is a shorthand for multiple OR conditions.
SELECT * FROM employees WHERE department IN ('HR', 'Finance', 'IT');
SELECT * FROM products WHERE category IN ('Books', 'Toys', 'Games');
The IN operator is useful for filtering data based on a list of potential matches, making queries cleaner and more efficient.
Console Output:
Department: HR
Category: Books
The BETWEEN operator selects values within a given range. It is inclusive, meaning the start and end values are included in the result set.
SELECT * FROM employees WHERE salary BETWEEN 40000 AND 60000;
SELECT * FROM products WHERE price BETWEEN 100 AND 500;
The BETWEEN operator is excellent for filtering data based on ranges, such as dates, prices, or quantities.
Console Output:
Salary: 55000
Price: 250
The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
SELECT * FROM employees WHERE name LIKE 'J%';
SELECT * FROM products WHERE description LIKE '%laptop%';
The LIKE operator is useful for pattern matching, allowing searches for partial matches in text fields.
Console Output:
Name: John
Description: High-performance laptop
The IS NULL operator is used to test for empty values (NULL).
SELECT * FROM employees WHERE manager_id IS NULL;
SELECT * FROM products WHERE discontinued IS NULL;
The IS NULL operator is critical for identifying records with missing information, ensuring data completeness and integrity.
Console Output:
Manager ID: NULL
Discontinued: NULL
The EXISTS operator is used to test for the existence of any record in a subquery. It returns true if the subquery returns one or more records.
SELECT * FROM employees WHERE EXISTS (SELECT 1 FROM departments WHERE departments.manager_id = employees.id);
The EXISTS operator is useful for checking the presence of related records, ensuring referential integrity in complex queries.
Console Output:
Employee: Exists in Department
The ALL operator is used to compare a value to all values in another value set or result from a subquery.
The ANY operator is used to compare a value to any value in a list or subquery. It returns true if any of the subquery values meet the condition.
SELECT * FROM products WHERE price > ALL (SELECT price FROM competitors);
SELECT * FROM orders WHERE quantity > ANY (SELECT quantity FROM sales);
The ALL and ANY operators are powerful tools for comparative analysis, allowing detailed evaluations against multiple criteria.
Console Output:
Product: Best Price
Order: High Quantity
Newsletter
Subscribe to our newsletter for weekly updates and promotions.
Wiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWiki E-Learning
E-LearningComputer Science and EngineeringMathematicsNatural SciencesSocial SciencesBusiness and ManagementHumanitiesHealth and MedicineEngineeringWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWikiCode
Programming LanguagesWeb DevelopmentMobile App DevelopmentData Science and Machine LearningDatabase ManagementDevOps and Cloud ComputingSoftware EngineeringCybersecurityGame DevelopmentWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki News
World NewsPolitics NewsBusiness NewsTechnology NewsHealth NewsScience NewsSports NewsEntertainment NewsEducation NewsWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterWiki Tools
JPEG/PNG Size ReductionPDF Size CompressionPDF Password RemoverSign PDFPower Point to PDFPDF to Power PointJPEG to PDF ConverterPDF to JPEG ConverterWord to PDF ConverterCompany
About usCareersPressCompany
About usCareersPressCompany
About usCareersPressLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesCompany
About usCareersPressCompany
About usCareersPressCompany
About usCareersPressLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesLegal
TermsPrivacyContactAds PoliciesAds Policies