user3085496
user3085496

Reputation: 205

Having trouble opening up a file in SQLite3

I have a .sql file called "lab13.sql" that I want to open in sqlite 3. I've downloaded sqlite3 from the website and I'm running it through GitBash. When I try .open lab13, it creates a new file and puts it in the file where sqlite3.exe is. However, there's nothing within that file and is not the original lab13 that I want.

I've also tried dragging the .sql file into GitBash but that doesn't work either (This is the second to last line in code).

sqlite> .open lab13.sql;
sqlite> select * from students;
Error: no such table: students
sqlite> .read lab13.sql;
sqlite> select * from students;
Error: no such table: students
sqlite> C:\Users\dorkh\Desktop\cs61a\lab\lab13\sqlite-tools-win32-x86-3330000\lab13.sql;
Error: near "C": syntax error

enter image description here

Does anyone know what I'm supposed to do? Thanks!

Upvotes: 0

Views: 248

Answers (1)

rutter
rutter

Reputation: 11452

The command you're using is close, but not quite right:

sqlite> .open lab13.sql;

SQLite is treating the semicolon as part of the filename that you want to open. Since there is no file named lab13.sql;, it creates that file and gives you an empty database.

Try this instead:

sqlite> .open lab13.sql

Upvotes: 1

Related Questions