Union Operator in SQLite

SQLite Union Operator To combine the result set of two or more tables, the SQLite UNION Operator is used with the SELECT statement. The result, however, includes only the unique rows and all duplicate rows are eliminated. It is mandatory to have the same number of fields in the result set in each SELECT statement. … Read more

Union All Operator in SQLite

SQLite Union All Operator To combine the result set of two or more tables without any elimination, the SQLite UNION All Operator is used with the SELECT statement. It is mandatory to have the same number of fields in the result set in each SELECT statement. Syntax: SELECT expression1, expression2, … expression_n FROM tables WHERE … Read more

DISTINCT Clause in SQLite

SQLite DISTINCT Clause To fetch only the unique records from a table the SQLite DISTINCT clause is used with the SELECT statement. Syntax: SELECT DISTINCT column_1, column_2,…..column_N FROM table_name WHERE conditions; Example: TEACHERS Table: ID NAME SALARY SUBJECT 1 Jim 10000 Geology 2 John 20000 Geology 3 Watson 15000 Physics 4 Holmes 25000 Chemistry 5 … Read more

HAVING Clause in SQLite

SQLite HAVING Clause To specify conditions for the groups created by the GROUP BY clause, the SQLite HAVING clause is used with the GROUP BY clause in the SELECT statement. Syntax: SELECT columns FROM table_name WHERE conditions GROUP BY columns HAVING conditions ORDER BY columns Example 1: TEACHERS Table: ID NAME SALARY SUBJECT 1 Jim … Read more

GROUP BY Clause in SQLite

SQLite GROUP BY Clause To group similar elements, from a table after fetching the records the GROUP BY clause is used in the SELECT statement. It is used with the WHERE clause before the ORDER BY clause. Syntax: SELECT column-list FROM table_name WHERE conditions GROUP BY column1, column2…column_N ORDER BY column1, column2…column_N [ASC | DESC]; … Read more

ORDER BY Clause in SQLite

SQLite ORDER BY Clause To sort the fetched data in ascending or descending order, the SQLite ORDER BY clause is used. The sorting can be done based on one or more column. Syntax: SELECT column-list FROM table_name WHERE condition ORDER BY column1, column2, .. column_N [ASC | DESC]; Example 1: TEACHERS Table: ID NAME AGE … Read more

LIMIT Clause in SQLite

SQLite LIMIT Clause To limit the number of records fetched from a table, the SQLite LIMIT clause is used with the SELECT command. Syntax 1: SELECT column1, column2, column_N FROM table_name LIMIT [no of rows] Syntax 2: Using Offset SELECT column1, column2, column_N FROM table_name LIMIT [no of rows] OFFSET [row num] Example 1: TEACHERS … Read more

GLOB in SQLite

SQLite GLOB To match the text values against a pattern, the SQLite GLOB operator is used. It uses wildcards: the asterisk sign (*) representing 0 or multiple numbers or characters; and the question mark (?) representing a single number or character. Syntax 1: SELECT FROM table_name WHERE column GLOB ‘XXXX*’ Syntax 2: SELECT FROM table_name … Read more

LIKE operator in SQLite

SQLite LIKE To match the text values against a pattern, the SQLite LIKE operator is used. It uses wildcards: the percent sign ( Syntax 1: SELECT FROM table_name WHERE column LIKE ‘XXXX Syntax 2: SELECT FROM table_name WHERE column LIKE ‘ Syntax 3: SELECT FROM table_name WHERE column LIKE ‘XXXX_’ Syntax 4: SELECT FROM table_name … Read more

OR condition in SQLite

SQLite OR To make multiple comparisons with different operators in the same statement, the SQLite OR clause is used. It is generally used with SELECT, UPDATE and DELETE statements. In the case of OR operation, if any of the given condition is true, the complete condition is considered true. It is always used with the … Read more