Analyzing CIA Factbook Data Using SQL guided project

Screen Link:

My Code:

%%capture
%load_ext sql
%sql sqlite:///factbook.db

%%sql
SELECT *
FROM sqlite_master
WHERE type=‘table’;

    ```

What I expected to happen:

 output:

type	name	tbl_name	rootpage	sql
0	table	facts	facts	2	CREATE TABLE "facts" ("id" INTEGER PRIMARY KEY...
1	table	sqlite_sequence	sqlite_sequence	3	CREATE TABLE sqlite_sequence(name,seq)

What actually happened: 

I already restarted the kernel, closed conda and restarted everything. Not sure what is going on. This is my first time working SQL on Jupyter

Thanks

Hi @paolagarcia0815

Hope you are having a good time learning data science.

Regarding your error took me a bit to find what was happening as the query is correct. Basically is an error in the symbols used you are using ‘’ but in sql and almost every single coding language we use ''

The error is actually telling you that as sqlite can’t find the column ‘table’

Hope that this helps

Good luck

Hello! I am having a lot of fun and learning a lot. I can’t believe it was so easy. it worked thanks!

However when I run the table it is empty

%%sql
SELECT *
  FROM sqlite_master
 WHERE type='table';

Output

* sqlite:///factbook.db
Done.
type	name	tbl_name	rootpage	sql
%%sql
SELECT *
  FROM facts
 LIMIT 5;

Output
* sqlite:///factbook.db
(sqlite3.OperationalError) no such table: facts
[SQL: SELECT *
  FROM facts
 LIMIT 5;]
(Background on this error at: https://sqlalche.me/e/14/e3q8)

Do you know what can be causing this?

I checked and the factbook.db file in the same folder/directory as the .ipynb file.

I also tried this solution posted How to connect to an sqlite database using sql magic command and ipython-sql

this works %sql sqlite:////Users/umesh/Downloads/chinook.db instead of %sql sqlite:////chinook.db

Thank you for your help.

I also got an empty table on my Jupiter but not on the local training interface/portal on dataquest dashboard!