Site icon TestingDocs.com

SQLite SELECT Statement

Overview

The SQLite SELECT statement retrieves records from a database table. This tutorial explains the syntax and provides examples of usage.

SQLite SELECT Statement

The general syntax of the database statement is as follows:

To retrieve all the columns of the table:

/> SELECT * FROM table_name;

We can specify the column names we want to retrieve in the SELECT statement.
The following syntax retrieves only the specified columns from the table.

/> SELECT column1, column2, … FROM table_name;

Example

For example, to retrieve all the columns of the emp database table, we can use the following command:

sqlite> SELECT * FROM emp ;
empno    name                  jobtitle              salary
—–        ————           ——–              ——
1              John Smith        SALESMAN    2500
2             Emma Johnson MANAGER     9500
sqlite>

sqlite> — Let’s retrieve only ename and salary columns
sqlite>
sqlite> SELECT ename, salary FROM emp;
ename                           salary
————                     ——
John Smith                  2500
Emma Johnson         9500
sqlite>
sqlite>
sqlite> — SQLite SELECT Statement

 

SQLite Tutorials

SQLite tutorials on this website:

https://www.testingdocs.com/sqlite-database-tutorials/

For more information on SQLite, visit the official website:

https://www.sqlite.org/

Exit mobile version