22 articles SQLite Tutorial

SQLite CREATE Table

The SQLite CREATE TABLE statement is used to create a new table in any of the given database. Creating a basic table involves naming the table and defining its columns and each column’s data type.   Syntax: Basic syntax of CREATE TABLE statement is as follows: CREATE TABLE database_name.table_name ( column1 datatype PRIMARY KEY (one…

SQLite DISTINCT Keyword

The SQLite DISTINCT keyword is used in conjunction with SELECT statement to eliminate all the duplicate records and fetching only unique records.   There may be a situation when you have multiple duplicate records in a table. While fetching such records, it makes more sense to fetch only unique records instead of fetching duplicate records.…

SQLite HAVING Clause

The HAVING clause enables you to specify conditions that filter which group results appear in the final results. The WHERE clause places conditions on the selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause.   Syntax: The following is the position of the HAVING clause in a SELECT…

SQLite GROUP BY

The SQLite GROUP BY clause is used in collaboration with the SELECT statement to arrange identical data into groups. The GROUP BY clause follows the WHERE clause in a SELECT statement and precedes the ORDER BY clause.   Syntax: The basic syntax of GROUP BY clause is given below. The GROUP BY clause must follow…

SQLite ORDER BY Clause

The SQLite ORDER BY clause is used to sort the data in ascending or descending order, based on one or more columns.   Syntax: The basic syntax of ORDER BY clause is as follows: SELECT column-list FROM table_name [WHERE condition] [ORDER BY column1, column2, .. columnN] [ASC | DESC]; You can use more than one…

SQLite LIMIT Clause

The SQLite LIMIT clause is used to limit the data amount returned by the SELECT statement.   Syntax: The basic syntax of SELECT statement with LIMIT clause is as follows: SELECT column1, column2, columnN FROM table_name LIMIT [no of rows] Following is the syntax of LIMIT clause when it is used along with OFFSET clause:…

SQLite GLOB Clause

  The SQLite GLOB operator is used to match only text values against a pattern using wildcards. If the search expression can be matched to the pattern expression, the GLOB operator will return true, which is 1. Unlike LIKE operator, GLOB is case sensitive and it follows syntax of UNIX for specifying THE following wildcards.…

SQLite LIKE Clause

The SQLite LIKE operator is used to match text values against a pattern using wildcards. If the search expression can be matched to the pattern expression, the LIKE operator will return true, which is 1. There are two wildcards used in conjunction with the LIKE operator:   The percent sign (%) The underscore (_) The…