Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial1 Answer
KRIS NIKOLAISEN
54,972 PointsIt's called an alias. Here alias_name will be the renamed column:
SELECT column_name AS alias_name FROM table_name;
Colton Shaw
12,634 PointsColton Shaw
12,634 PointsThis answer is actually using a select statement. While this will alias the column to whatever you want, it's only temporary and only used for that select query.
To completely rename a column it appears SQLite did not support this until recently. In our practice environment, you'll have to copy the instructions in this link under "The old way to rename column".
Remember, every SQL software could be slightly different on this so Google will be your best friend. In our environments it appears the 'alter table name rename' does not work and you'll have to drop and re-add the table.