# Need help learning Julia (tutorial example doesn't work for SQLite.Query

**URL:** <https://discourse.julialang.org/t/need-help-learning-julia-tutorial-example-doesnt-work-for-sqlite-query/64942>\
**Category:** General Usage\
**Tags:** package\
**Created:** [July 19, 2021, 6:29pm UTC](https://discourse.julialang.org/t/need-help-learning-julia-tutorial-example-doesnt-work-for-sqlite-query/64942 "2021-07-19T18:29:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChaoticSun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chaoticsun/32/27320_2.png) [@ChaoticSun](https://discourse.julialang.org/u/ChaoticSun)\
**Post date:** [July 19, 2021, 6:29pm UTC](https://discourse.julialang.org/t/need-help-learning-julia-tutorial-example-doesnt-work-for-sqlite-query/64942/1 "2021-07-19T18:29:48Z")

</div>

Good afternoon. I’m trying to learn Julia and found a long tutorial (over 4 hours). I’ve been tracking along pretty well until I hit the database section using the SQLite package. I’ve created the DB (a very simple one entry movies database with only a couple of fields) and have been able to complete the tutorial with only minor issues until I reached this stage. We are using the SQLite package and this is the command I am trying to execute and the error response I receive:

Command:

```julia
using Pkg
Pkg.add("SQLite")
using SQLite

db = SQLite.DB("Movies")
SQLite.execute(db,"CREATE TABLE IF NOT EXISTS movies(movie_id REAL, movie_name TEXT, location TEXT")
SQLite.tables(db)
SQLite.execute(db,"INSERT INTO Movies (movie_id,movie_name,location) VALUES(1,'Avengers','USA')")
SQLite.Query("SELECT * FROM movies")

```

The error I receive is:

```julia
using Pkg
Pkg.add("SQLite")
using SQLite

db = SQLite.DB("Movies")
SQLite.execute(db,"CREATE TABLE IF NOT EXISTS movies(movie_id REAL, movie_name TEXT, location TEXT")
SQLite.tables(db)
SQLite.execute(db,"INSERT INTO Movies (movie_id,movie_name,location) VALUES(1,'Avengers','USA')")
SQLite.Query("SELECT * FROM movies")

```

I really don’t know what this means from a diagnostic standpoint, but I’m wondering if something has changed with the package since the tutorial was posted or because of the version difference in Julia itself. Tutorial was from October 2019 and was using Julia 1.2.0. I’m on 1.6.1.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [July 19, 2021, 7:34pm UTC](https://discourse.julialang.org/t/need-help-learning-julia-tutorial-example-doesnt-work-for-sqlite-query/64942/2 "2021-07-19T19:34:43Z")

</div>

You posted the code twice rather than including the error. Also, could you please link the tutorial that you are using.

---

<div class="post-metadata">

**Author:** ![neophytedave](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/neophytedave/32/202273_2.png) [@neophytedave](https://discourse.julialang.org/u/neophytedave)\
**Post date:** [July 19, 2021, 8:42pm UTC](https://discourse.julialang.org/t/need-help-learning-julia-tutorial-example-doesnt-work-for-sqlite-query/64942/3 "2021-07-19T20:42:20Z")

</div>

I would be interested in the link also

---

<div class="post-metadata">

**Author:** ![ChaoticSun](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chaoticsun/32/27320_2.png) [@ChaoticSun](https://discourse.julialang.org/u/ChaoticSun)\
**Post date:** [July 19, 2021, 9:01pm UTC](https://discourse.julialang.org/t/need-help-learning-julia-tutorial-example-doesnt-work-for-sqlite-query/64942/4 "2021-07-19T21:01:04Z")

</div>

> [@ChaoticSun](#):
>
> Good afternoon. I’m trying to learn Julia and found a long tutorial (over 4 hours). I’ve been tracking along pretty well until I hit the database section using the SQLite package. I’ve created the DB (an elementary one entry movies database with only a couple of fields). I have been able to complete the tutorial with only minor issues until I reached this stage. We are using the SQLite package, and this is the command I am trying to execute and the error response I receive:
> 
> Command:
> 
> ```julia
> using Pkg
> Pkg.add("SQLite")
> using SQLite
> 
> db = SQLite.DB("Movies")
> SQLite.execute(db,"CREATE TABLE IF NOT EXISTS movies(movie_id REAL, movie_name TEXT, location TEXT")
> SQLite.tables(db)
> SQLite.execute(db,"INSERT INTO Movies (movie_id,movie_name,location) VALUES(1,'Avengers','USA')")
> SQLite.Query("SELECT * FROM movies")
> 
> ```
> 
> The error I receive is:
> 
> ```julia
> using Pkg
> Pkg.add("SQLite")
> using SQLite
> 
> db = SQLite.DB("Movies")
> SQLite.execute(db,"CREATE TABLE IF NOT EXISTS movies(movie_id REAL, movie_name TEXT, location TEXT")
> SQLite.tables(db)
> SQLite.execute(db,"INSERT INTO Movies (movie_id,movie_name,location) VALUES(1,'Avengers','USA')")
> SQLite.Query("SELECT * FROM movies")
> 
> ```
> 
> I really don’t know what this means from a diagnostic standpoint. Still, I wonder if something has changed with the package since the tutorial was posted or because of the version difference in Julia itself. The tutorial was from October 2019 and was using Julia 1.2.0. I’m on 1.6.1.

Sorry for the wrong posting. The tutorial I’m using is [Julia Tutorial \ Julia Data Science Basic Full Course [Complet Tutorial] for Beginners [2019]](https://www.youtube.com/watch?v=lwj-1mclq0U&t=2069s)

I actually found the answer after a bit more Googling. It appears the tutorial is wrong. The correct way to do this is to use something like this:

```julia
# To load a specific table (movies table from Movies.db)
q = "SELECT * FROM movies"
data = SQLite.DBInterface.execute(db,q)

DataFrames.DataFrame(data)

```

This produces the correct output.

Thanks for your quick responses, but I can close the .question now as I found the answer. I’ve found another couple things in the tutorial that are wrong, but for the most part, it’s been pretty spot on.
