Skip to content

Commit ed4b808

Browse files
committed
Update
1 parent e9d9b49 commit ed4b808

1 file changed

Lines changed: 10 additions & 23 deletions

File tree

sqlite.md

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ engine in the world.
1313
SQL](http://web.csulb.edu/colleges/coe/cecs/dbdesign/dbdesign.php)
1414

1515
In this tutorial, we will learn how to convert CSV files to database
16-
tables and run simple SQL queries Python using SQLite3. In this article
17-
we use “surveys.csv” and “species.csv” files from
18-
[here](https://figshare.com/articles/dataset/Portal_Project_Teaching_Database/1314459/10).
16+
tables and run simple SQL queries in Python. We are using “surveys.csv”
17+
and “species.csv” files from
18+
[here](https://figshare.com/articles/dataset/Portal_Project_Teaching_Database/1314459/10)
19+
to practice our learning.
1920

2021
-----
2122

@@ -262,26 +263,12 @@ For example, change the directory to your database location and enter
262263
`sqlite3 eco.db` to open the database and run:
263264

264265
``` sql
265-
.schema --to see the schema of the databse
266-
.tables --to list tables in the databaset
267-
.mode column --to see in column mode
268-
.header on --to show headers
269-
270-
PRAGMA TABLE_INFO(species); --to see tables info
271-
-- cid name type notnull dflt_value pk
272-
-- --- ---------- ---- ------- ---------- --
273-
-- 0 species_id text 0 1
274-
-- 1 genus text 0 0
275-
-- 2 species text 0 0
276-
-- 3 taxa text 0 0
277-
278-
SELECT * FROM survey ORDER BY year ASC LIMIT 4;
279-
-- record_id month day year plot_id species_id sex hindfoot_length weight
280-
-- --------- ----- --- ---- ------- ---------- --- --------------- ------
281-
-- 1 7 16 1977 2 NL M 32.0
282-
-- 2 7 16 1977 3 NL M 33.0
283-
-- 3 7 16 1977 2 DM F 37.0
284-
-- 4 7 16 1977 7 DM M 36.0
266+
.schema -- to see the schema of the databse
267+
.tables -- to list database tables
268+
.mode column -- to see in column mode
269+
.header on -- to show headers
270+
PRAGMA TABLE_INFO(species); -- to see tables info
271+
SELECT * FROM survey ORDER BY year ASC LIMIT 10;
285272
```
286273

287274
---

0 commit comments

Comments
 (0)