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 Console Foundations Installing Software Building Software From Source

Carlos Reyes
Carlos Reyes
30,056 Points

Typing sqlite3 in min 11:35

In min 11:35 when I type "sqlite3" my prompt changes to "sqlite3 " then I type .help, and it changes again to "...>". By hiting crtl-z it is stopped and I can see again the "treehouse ~ $" prompt, then fg and I return to "...>"

My questions are how do I close sqlite3? What else to type after ".help", to get the hints?

1 Answer

Sam Hall
PLUS
Sam Hall
Courses Plus Student 8,636 Points

I accidentally typed ls after launching sqlite3 and I got stuck with the ..> prompt as well. This is what I found out, in case it is useful for someone.

  • Commands in sqlite3 start with a dot. For example: .help.
  • If you type anything that doesn't start with a dot at the sqlite> prompt, it expects that you are typing SQL statements. This changes to prompt to ..> to allow you to add more lines.
  • The way to get out of this is to type a semi-colon (;). This ends the sql statement and will take you back to the sqlite> prompt.
  • To leave from the sqlite> prompt, type .quit or .exit.

For example, here I start sqlite and then accidentally type ls. I end the statement using ; and the quit. The syntax error is because ls is not valid SQL:

treehouse ~ $ sqlite3                                                   
SQLite version 3.11.1 2016-03-03 16:17:53                               
Enter ".help" for usage hints.                                          
Connected to a transient in-memory database.                            
Use ".open FILENAME" to reopen on a persistent database.                
sqlite> ls                                                              
   ...> ;                                                               
Error: near "ls": syntax error                                          
sqlite> .quit                                                           
treehouse ~ $

I found that .help works so long as you are at the sqlite> prompt.

Further info: http://www.tutorialspoint.com/sqlite/sqlite_commands.htm, http://www.sitepoint.com/getting-started-sqlite3-basic-commands