Select data from a table with the SELECT query.

You can grab data from your database with the select data. This can be a whole table or specific columns.

You may like:
Learning SQL: Master SQL Fundamentals

Select query

Connect to database

First connect to your database with

1
$sqlite3 database.db

where database.db is your existing database.

View the tables with the query

1
.tables

Select query

Use the select query to grab data:

1
SELECT * FROM EMPLOYEE;

This will return all table contents:

1
2
3
4
5
6
SQLite version 3.23.1 2018-04-10 17:39:29
Enter ".help" for usage hints.
sqlite> SELECT * FROM EMPLOYEE;
1|Alica|Bachelor|2000.0
2|Bob|PhD|2500.0
sqlite>

To select everything from a table, you use:

1
SELECT * FROM table_name;

Select columns

You can grab specific columns:

1
SELECT name, salary FROM EMPLOYEE;

Pick any columns from the table you want.

So to select data from a table, just use

1
SELECT columns FROM table_name;

Video

Video demo below: