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 trial

Development Tools

Edwin Goddard
Edwin Goddard
8,988 Points

Altering Tables challenge unpassable

It is impossible to pass the challenge for altering tables in the Database Foundations course.

The second challenge asks you to rename a table, but I get a SQL error stating that there is already a table of that name.

Challenge task 2 of 4 Rename in one SQL statment both the "t_movie" table to "movies" and the "t_actor" table to "actors". Type in your command below, then press Enter.

Here is the answer I give

RENAME TABLE movies to t_movie, actors to t_actor;

and the error: SQL Error: Table 't_movie' already exists

Can you get this fixed?

2 Answers

Ron McCranie
Ron McCranie
7,837 Points

The instructions say "t_movie" table to "movies" Your statement was doing the inverse.

TRY:

RENAME TABLE t_movie to movies, t_actor to actors;
Edwin Goddard
Edwin Goddard
8,988 Points

thanks, silly me, didn't read the instructions properly, just assumed it was the same way round as in the video.

Thanks again,

Edwin

DATABASE FOUNDATIONS / SQL

Challenge Task 1 of 4

Rename the "actors" table to "t_actor".

RENAME TABLE actors to t_actor;

Challenge Task 2 of 4

Rename in one SQL statment both the "t_movie" table to "movies" and the "t_actor" table to "actors".

RENAME TABLE t_movie to movies, t_actor to actors

Challenge Task 3 of 4

Remove the "actors" table from the database.

DROP TABLE actors;

Challenge Task 4 of 4

Truncate the "movies" table.

TRUNCATE table movies;