4

Really, what could possibly be wrong?! It does not get any more simple - the entire query:

line 1: use foo
line 2: 
line 3: select * from test_table_1;

Error Code:

  1. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from test_table_1' at line 3 0.002 sec

The line numbers are for reference only - there not actually in the query window.

I'm trying to run this extremely simple query in MySQLWorkbench and it's throwing a syntax error.

2 Answers 2

5

Try adding a semicolon:

use foo;
Sign up to request clarification or add additional context in comments.

2 Comments

This would be a much better answer if you explained why a semicolon is needed, instead of just "Try adding". "Try adding" is a suggestion, not an answer. :)
Gracias! that's the missing link. I keep forgetting that MySQL is very particular about the semicolon. My bad habits :^)
0

Without semicolon both statements will treat as single one. By adding semicolon MySQL will treat both statements as multiple queries. Try using

 use foo;
    /*and then*/
    select * from foo;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.