About 236,000 results
Open links in new tab
  1. Conditions in MySQL with Examples - Dot Net Tutorials

    In MySQL, a condition or an expression is made up of keywords, identifiers, and constants and it compares given values with the data rows values in a table. If the condition is matched with the data row it’s called a true condition otherwise a false condition. The syntax is given in the below image. Examples to Understand Conditions in MySQL:

  2. IF, IF-THEN, IF-THEN-ELSE and IF-THEN-ELSEIF-ELSE Statement

    Aug 21, 2024 · MySQL offers conditional control flow with IF statements, allowing us to execute blocks of SQL code depending on whether a condition is true or false. In this article, We will learn about What is Decision-Making in MySQL with different statements along with examples and …

  3. MySQL IF() Function - W3Schools

    The IF() function returns a value if a condition is TRUE, or another value if a condition is FALSE. Syntax

  4. sql - Conditional filter for MySQL query - Stack Overflow

    Feb 11, 2010 · join images i on i.image_id = ai.image_id. join image_sizes is on is.image_id = i.image_id. where is.size_name = '96x96'; So there is an N:N relationship between articles and images, and an N:1 relationship between images and …

  5. How do you write a conditional in a MySQL select statement?

    Oct 30, 2009 · This is the preferable answer - CASE is ANSI standard, the query would work without alteration on SQL Server, Oracle, MySQL, Postgres... The IF () statement works similarly to the ternary ? : operator. I was trying to conditionally pick column_a or column_b (using one as a fallback if the other was null) and this did it for me. Thank you!

  6. MySQL IF Expression: Usage & Examples - DataCamp

    The `IF` expression is primarily used to return different values based on a condition within queries. It is useful for implementing conditional logic directly in SQL, particularly in `SELECT` statements.

  7. MySQL :: MySQL 8.4 Reference Manual :: 15.6.5.2 IF Statement

    If a given search_condition evaluates to true, the corresponding THEN or ELSEIF clause statement_list executes. If no search_condition matches, the ELSE clause statement_list executes.

  8. How to Execute an IF…THEN Logic in an SQL SELECT Statement

    Mar 26, 2025 · In this tutorial, we’ll explore how to implement IF-THEN logic in SQL across various dialects such as SQL Server, MySQL, and PostgreSQL. 2. Using CASE. The CASE statement acts as a logical IF-THEN-ELSE conditional statement.

  9. MySQL If statement with multiple conditions - Stack Overflow

    Feb 22, 2017 · IF (yourCondition [logical operator(OR, AND) another condition] ) THEN So in a practical example: DECLARE m integer; DECLARE n integer; SET m = 1; SET n = 0; IF ((m>n AND m=1 AND n=0) OR m=n)THEN some code here END IF;

  10. MySQL IF Statement - MySQL Tutorial

    This tutorial shows you how to use MySQL IF statement to execute a block of SQL code based on a specified condition.

  11. Some results have been removed
Refresh