Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,836 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;