Hi, I’m on Ex.3 running windows 7. When I run the following, PowerShell does not show the steps that SQLite is taking. Any thoughts on why this is the case?
Also, after I create ex3.db from ex2.sql, I am shoved into sqlite and have to .quit before continuing (i.e. PowerShell switches the line’s “prefix” from C:\xxxxxx to sqlite>). When I try to init ex3.sql into the newly created ex3.db, it won’t let me while the sqlite> prefix is active. Am I missing something?
Hi, I’d need more context. Zed might know because he knows what is in exercise 3. Post the code you are running. You’ve describe well what you expect to happen. But, without seeing the code your trying to run, I can’t help fix it.
Hmmm, can you show me a screenshot please so I make sure I’m giving you the right advice? Chances are you doing it right but just don’t understand how sqlite3.exe works.
Some info that might help others:
From my experience “-init” must be followed by the SQL script name “ex2.sql”
So the following 2 commands work on Windows PowerShell:
sqlite3 -init ex2.sql ex3.db
From the html version of the book:
sqlite3 ex3.db -init ex2.sql
Please @zedshaw would you have a workaround to the fact that
-echo
does not print the SQL commands on Windows PowerShell? As in:
sqlite3 ex3.db -init ex2.sql -echo
I have tried to place “-echo” to several places in the command line, but with no success.
Option “-help” works, but I wasn’t able to make “-column” nor “-header” options work either
To add to jbbourdu’s response, there are a couple of other possibilities for this too…
Firstly you can set up a Debian Virtual Machine (there is a video describing this process in the Learn SQL The Hard Way package) and use the bash terminal from there. That way -echo, -column and -header all work, as does the < (redirect input from file) operator which means you don’t subsequently need to run the .exit command to exit the sqlite3 shell.
Secondly, if you don’t wan’t to set up a Debian (or other Unix) virtual machine and are running Windows 10 (up to date; specifically, including the “Creators update” from September 2017) you can use the Linux/bash shell with the Windows Subsystem for Linux. This page on Microsoft’s website explains how to install the Windows Subsystem for Linux with either Ubuntu, OpenSUSE or SLES (it’s quick and easy). From here, you can simply open a PowerShell window, run the bash command to enter the bash shell then complete all exercises from there. As above, -echo, -column and -header all work, as does the < (redirect input from file) operator which means you don’t subsequently need to run the .exit command to exit the sqlite3 shell. If you want to exit the bash shell (and return to PowerShell) just run the exit command.