JAVA
public class Main {
public static void main(String[] args) {
int x = 5;
System.out.println(x > 3 && x < 10); // returns true because 5 is greater than 3 AND 5 is less than 10
}
}
Explanation :
int x = 5;Declares an integer variable named
xand assigns it the value5.x > 3Evaluates whether
x(which is5) is greater than3. This statement is true.x < 10Evaluates whether
x(which is5) is less than10. This statement is true.x > 3 && x < 10The
&&symbol is the logical AND operator. It requires both sides of the expression to be true for the entire condition to be true.Since
5 > 3is true and5 < 10is true, the overall result of the expression istrue.System.out.println(...)Prints the result of the expression (
true) to the console.
SQL
All Conditions Must Be True
The following SQL selects all customers where Country is "Brazil" AND City is "Rio de Janeiro" AND CustomerID is higher than 50:
Example
SELECT * FROM Customers
WHERE Country = 'Brazil'
AND City = 'Rio de Janeiro'
AND CustomerID > 50;
References:
https://www.w3schools.com/sql/sql_and.asp
https://www.w3schools.com/java/java_examples.asp
Top comments (0)