By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE baskets (
basketNum int,
fruit varchar(20),
amount int
);
INSERT INTO baskets VALUES
(1, 'Apple', 3),
(2, 'Apple', 1),
(3, 'Apple', 2),
(3, 'Orange', 1),
(4, 'Orange', 3);
Records: 5 Duplicates: 0 Warnings: 0
set @status = "Rotten";
SELECT fruit as @status from baskets;
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@status from baskets' at line 1
set @status = "Rotten";
SELECT fruit as Rotten from baskets;
Rotten |
---|
Apple |
Apple |
Apple |
Orange |
Orange |