Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Load schema and import planets.csv

.mode batch

.read examples/planets.sql
.import --csv --skip 1 -v examples/planets.csv planets
SELECT '----------';

.schema
SELECT '----------';

SELECT * FROM planets;
SELECT "Distance (AU)" FROM planets;

$ sqlite3 < exampes/create-and-import-planets.sql
Column separator ",", row separator "\n"
Added 11 rows with 0 errors using 12 lines of input
----------
CREATE TABLE planets (
    "Planet name" TEXT,
    "Distance (AU)" REAL,
    Mass  REAL
);
----------
Mercury|0.4|0.055
Venus|0.7|0.815
Earth|1.0|1.0
Mars|1.5|0.107
Ceres|2.77|0.00015
Jupiter|5.2|318.0
Saturn|9.5|95.0
Uranus|19.6|14.0
Neptune|30.0|17.0
Pluto|39.0|0.00218
Charon|39.0|0.000254
0.4
0.7
1.0
1.5
2.77
5.2
9.5
19.6
30.0
39.0
39.0