Q1
True / FalseIn MySQL, the 'AND' operator is used to combine multiple conditions and returns true only if all conditions are true.
The 'AND' operator requires all combined conditions to be true for the overall expression to be true.
Q2
True / FalseThe 'OR' operator in MySQL returns true if at least one of the combined conditions is true.
The 'OR' operator returns true if any of the combined conditions are true.
Q3
True / FalseIn MySQL, the expression 1 AND 0 evaluates to true.
The expression 1 AND 0 evaluates to false because both conditions must be true for the 'AND' operator to return true.
Q4
True / FalseIn MySQL, the 'AND' operator has higher precedence than the 'OR' operator.
The 'AND' operator has higher precedence, meaning it is evaluated before the 'OR' operator unless parentheses are used to explicitly define the order.
Q5
True / FalseThe query SELECT * FROM employees WHERE age > 30 AND age < 50 OR salary > 50000; will return employees who are either aged between 30 and 50 or have a salary greater than 50000.
Due to operator precedence, age > 30 AND age < 50 is evaluated first, and then OR salary > 50000 is evaluated.
Q6
True / FalseThe query SELECT * FROM products WHERE price < 100 AND category = 'Electronics' OR stock > 50; will return all electronics priced under 100, as well as any product with stock greater than 50.
The 'AND' condition is evaluated first, and then 'OR stock > 50' includes additional products with stock greater than 50.
Q7
True / FalseIn MySQL, you can use both 'AND' and 'OR' operators within the same WHERE clause to create complex conditions.
MySQL allows the combination of 'AND' and 'OR' operators in the same WHERE clause to form complex conditional statements.
Q8
True / FalseThe expression (condition1 OR condition2) AND condition3 is equivalent to condition1 OR (condition2 AND condition3) in MySQL.
The expressions are not equivalent due to the different order of evaluation influenced by parentheses and operator precedence
Q9
True / FalseThe query SELECT * FROM orders WHERE (customer_id = 1 OR customer_id = 2) AND (status = 'shipped' OR status = 'pending'); will return orders for customers 1 or 2 that are either shipped or pending.
The use of parentheses groups conditions correctly, ensuring that the query returns the intended results.
Q10
True / FalseIn MySQL, using 'AND' and 'OR' operators within a single query can impact query performance, especially when dealing with large datasets.
Combining 'AND' and 'OR' operators in queries can affect performance due to the complexity of evaluating multiple conditions, especially in large datasets. Proper indexing and query optimization techniques are necessary to mitigate performance issues.