Cross Join in SQLite

SQLite Cross Join To join each row of the first table (of x number of rows) with each row of the second table (of y number of rows), the Cross join is used in SQLite. The resultant thus contains x*y number of rows. Syntax: SELECT columns FROM table1 CROSS JOIN table2 Example: STUDENTS Table: STUDENT_ID … Read more

Outer Join in SQLite

SQLite Outer Join Unlike SQL, the SQLite supports only one type of OUter JOin and that is the Left Outer Join. SQLite Left Outer Join: The SQLite left outer join fetches all the rows from the specified fields of the left-hand table. However, for the right-hand table, it joins only those rows where the join … Read more

Inner Join in SQLite

SQLite Inner Join To combine all rows from multiple tables, the SQLite Inner join is used. However, it joins only those rows where the join condition is satisfied. It is the simplest, most popular and the default type of Join in SQLite. Syntax 1: SELECT columns FROM table_1 INNER JOIN table_2 ON conditions Syntax 2: … Read more

Joins in SQLite

SQLite Joins To combine records from two or more tables in a database, the SQLite Joins are used. The common values in the mentioned fields from the tables are fetched and displayed as the result.   Types of SQLite Joins: SQLite supports three types of Joins, including, SQLite INNER JOIN SQLite OUTER JOIN SQLite CROSS … Read more

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