Resolved: SELECT statement works but why?
I have two questions (please see my screenshot below):
1. the select contains no semicolon at the end but the statement still works. I expected an error.
2. how does the "statement" know which database/schema to use? I expected to enter the command "USE employees" before.
Thanks for reaching out.
1) The query still works, but if you have another query after this, an error 1064 will occur. So, it is best practice to use
; at the end of your query.
2) Actually, you have to double-click on the DB you want to work with, or use:
otherwise an error 1046 will occur. In this particular case some default database may be set. But the database should be bolded. So, you can just double-click and select your database.
Hope this helps.