Computer Science for IGCSE & O level - Databases (Section 1 - No. 44)
In the provided example, what would be the correct SQL command to find records where SeatColour is 'Red' AND (White OR Silver)?
SELECT * FROM CAR WHERE SeatColour = 'Red' AND (White OR Silver);
SELECT * FROM CAR WHERE SeatColour = 'Red' AND (White = 'Y' OR Silver = 'Y');
SELECT * FROM CAR WHERE SeatColour = 'Red' OR White = 'Y' OR Silver = 'Y';
SELECT Code FROM CAR WHERE SeatColour = 'Red' AND ('White' OR 'Silver');
Explanation
Option 1 does not work as 'OR' does not work like that in SQL. Option 2 correctly uses the 'AND' operator to combine the conditions.
Comments (0)
