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

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 :)