Why rename column using alias instead of ALTER TABLE?

In the course “Analyze Data with SQL” Extra Practice Module about Davie’s Burgers number 9 says the following (pasted below in ITALICS). My instinct was to do the ALTER TABLE below. But it wanted to me to do the alias instead. WHY? WHY WON’T MY METHOD WORK? Why is their method better? I’m very lost on this. Any help greatly appreciated.

ALTER TABLE orders
RENAME COLUMN id to #
ALTER TABLE orders
RENAME COLUMN special_instructions to Notes;

SELECT*
FROM orders;

But, it would not let me do this. It required me to:
SELECT id AS ‘#’,
special_instructions AS ‘Notes’
FROM orders
WHERE special_instructions LIKE ‘%box%’;

Wow, some of these are marketing gold! But what are their order numbers?

Instead of just returning the special instructions, also return their order ids.

For more readability:

** Rename id as ‘#’*
** Rename special_instructions as ‘Notes’*

Aliases are temporary, using ALTER is permanent. You don’t want to permanently change the column (or table) name in a query in the lesson.

Ahh thank you so much!! Makes sense

1 Like