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

Reed Williams
Reed Williams
3,323 Points

Database Foundations: Running a Script and Using MySQL Workbench: Error: Error formatting SQL query: empty string

I'm using Windows 8.1, 64 bit, MySQL 5.6.23.

I'm using a document(movie_db.sql) from a learning exercise. I downloaded & saved the script(C:\Users\Reed\OneDrive\SQLProjects\TeamTreeHouseDatabaseFoundations\movie_db.sql).

Opened the script in MySQL: File> Open sql script> selcted the above script > "lightning bolt" > result in Action Output shows a warning in row 1:

1 1 19:39:01 DROP DATABASE IF EXISTS treehouse_movie_db 0 row(s) affected, 1 warning(s): 1008 Can't drop database 'treehouse_movie_db'; database doesn't exist 0.000 sec

Created a query > SELECT * FROM movies; > "lightning bolt" > got the following:

5 42 19:44:07 SELECT * FROM movies LIMIT 0, 1000 Fetching... 0.000 sec / ?

0 43 19:44:07 SELECT * FROM movies LIMIT 0, 1000 Error: Error formatting SQL query: empty string given as argument for ! character

Screen Shots:

MySQL Home: http://screencast.com/t/tIDDDTDydvbE

document/SQL Script: http://treehouse-code-samples.s3.amazonaws.com/DBFoundations/stage_2/movie_db.sql

Startup/Shutdown Server is running: http://screencast.com/t/yoH1UOzCw

Action Output warning 1: http://screencast.com/t/hr88FTb9t

Query 1: http://screencast.com/t/xBkvXrDKE

I'm new to MySQL, looking to understand what's going on here & how it can be corrected. Thank you.

6 Answers

Peter Do
Peter Do
12,294 Points

Reed,

Try selecting the treehouse_movie_db by double clicking on it under SCHEMAS (it will turn bold). Then rerun your query and it should return the 250 rows.

Thanks. It worked

Much appreciated, Peter!

Albert González
Albert González
22,953 Points

The query to select the movie "lightning bolt" is:

select * from movies where title='lightning bolt'

Try it!

I had just gotten stuck at the same point. Thanks Reed for discovering this before me and thanks to Peter for the solution!

Yup Reed is Right! Thanks a tonne for the solution Peter :)

catalin moraru
catalin moraru
8,813 Points

Thumbs up for Reed Williams and Peter Do. Everyone in this website should learn from this example when it comes to asking a question on this forum.

Cheers

Dustin Warren
Dustin Warren
1,023 Points

You guys are awesome, thanks :)