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 Database Foundations Installing MySQL Server and MySQL Workbench Running a Script and Using MySQL Workbench

error executing query

I am receiving the error: Error formatting SQL query: empty string given as argument for !character

Has anyone else gotten this?

Can you please post your code?

Input: SELECT * FROM movies;

Output: Error: Error formatting SQL query: empty string give as argument for ! character

Thanks for the help!

9 Answers

Peter Anderovsky
Peter Anderovsky
2,602 Points

You have to double click on database name in the left panel to become bold.

Andrei Gavrila
Andrei Gavrila
487 Points

This helped me too!

Erich Stauffer
Erich Stauffer
1,632 Points

Thanks, Peter! This one had me stumped.

Thanks. Helped me too ! :)

Don Hamilton III
Don Hamilton III
31,828 Points

Wow. Seems so simple when you see it like this. Didn't know you had to double click until I saw this post. Thanks man.

Thank you… this helped me

Ria Carmin
PLUS
Ria Carmin
Courses Plus Student 11,848 Points

I also fixed it by double-clicking the database name ("treehouse_movie_db") on the left pane. I didn't even have to restart my computer.

The query should be just SELECT * FROM movies; not Input: SELECT * FROM movies;

Sorry, I was trying to say that that's what I was inputting..

I still get the same error with

SELECT * FROM movies;

Looks like the name of the table is different. I'm getting the same error. When clicking on the little grid box, next to the tool icon and information icons (under Schemas), you can see that the table is actually displayed. The code on it says: SELECT * FROM treehouse_movie_db.movies;

I don't know why the name is different though....

Hope it helps!

Andres Oliva ran into the same problem - turns out the fix is very simple. Here's his answer that worked for me also.

"I don't know if you're in the exact same situation as me, but I was working on the project right after I installed the workbench. I restarted my computer and run the statement again, I only got an error that's fixed simply double clicking the database name "treehouse_movie_db" on the sidebar. Right now I am almost at the end of the course and I haven't had any more issues :)

Hope that helps!"

Thanks Andres!

Got the same issue: "08:47:09 select * from movies LIMIT 0, 1000 Error: Error formatting SQL query: empty string given as argument for ! character" but having read these coments, i double clicked the movies db and it immediately ran fine.. probably need to explain in the script about selecting which db to work on or something? Sorry - complete beginner.

Regards,

John

I got the same error also...I used to see this in SQL Server Management Studio too (but there was a drop-down box there so you could easily see which database you were selecting from). You have to select the database first before selecting from it, which as Peter says you can do my double-clicking it on the left-hand side under SCHEMAS. Thanks for that, Peter!

I got the same error also, and found my answer here - needing to double-click the database name in order to select it prior to running the query. This is not all that dissimilar to phpmyadmin, for those who are familiar, in that you need to select a specific database before importing, exporting, or running a query.

Thanks that answer helped me too. Pretty glaring omission from the video for the folks at Treehouse.

This helped me too - another great example of this awesome community - thanks.