AND condition in SQLite

SQLite AND To make multiple comparisons with different operators in the same statement, the SQLite AND Operator are used. It is generally used with SELECT, UPDATE and DELETE statements. It is a conjunctive operator and is always used with the WHERE Clause. Syntax: SELECT column_1, column_2, column_N FROM table_name WHERE condition_1 AND condition_2…AND condition_N; Example: … Read more

WHERE Clause in SQLite

SQLite WHERE Clause To specify a condition for fetching only the necessary data from a table or tables, the SQLite WHERE clause is used. It is generally used with SELECT, UPDATE and DELETE statements. Syntax: SELECT column_1, column_2, column_N FROM table_name WHERE expression; Example 1: Using WHERE clause with the SELECT statement. TEACHERS Table: ID … Read more

DELETE Query in SQLite

SQLite DELETE Query To delete the existing records from a table, the DELETE query is used in SQLite. Syntax: DELETE FROM table_name WHERE conditions; Example 1: TEACHERS Table: ID NAME SUBJECT 1 Jim English 2 John Geology 3 Watson French 4 Holmes Chemistry 5 Tony Physics Example: DELETE FROM TEACHERS WHERE ID = 2;DELETE FROM … Read more

UPDATE Query in SQLite

SQLite UPDATE Query To modify the existing records in a table, the UPDATE query is used in SQLite. Syntax: UPDATE table_name SET column_1 = value_1, column_2 = value_2…., column_N = value_N WHERE conditions; Example 1: TEACHERS Table: ID NAME SUBJECT 1 Jim English 2 John Geology 3 Watson French 4 Holmes Chemistry 5 Tony Physics … Read more

SELECT Query in SQLite

SQLite SELECT Query To fetch data from a table, the SELECT statement is used in SQLite. Syntax 1: To select specific fields from a table. SELECT column_1, column_2, column_N FROM table_name WHERE expression; Syntax 2: To select all fields from a table. SELECT * FROM table_name; Example: SELECT * FROM TEACHERS;SELECT * FROM TEACHERS; Output: … Read more

Insert Query in SQLite

SQLite Insert Query To add data into a table, the INSERT INTO statement is used in SQLite. Syntax 1: If adding values to only some of the columns in a table or if adding values in random order. INSERT INTO TABLE_NAME [(column_1, column_2, column_3,…column_N)] VALUES (value_1, value_2, value_3,…value_N); Syntax 2: If adding values to all … Read more

Drop Table SQLite

SQLite Drop Table To remove a table, the DROP TABLE statement is used in SQLite. It also eliminates the definition and all the associated data, constraints, triggers, indexes, and permission specifications of the specified table. It removes the data permanently. Syntax: DROP TABLE database_name.table_name; Example: DROP TABLE TEACHERS;DROP TABLE TEACHERS; Explanation: In the above example, … Read more

SQLite Create Table

SQLite Create Table To create a new table, the CREATE TABLE statement is used in SQLite. Syntax: CREATE TABLE database_name.table_name( column_1 datatype PRIMARY KEY(one or more columns), column_2 datatype, column_3 datatype, ….. column_N datatype, ); Example: CREATE TABLE TEACHERS( ID INT PRIMARY KEY NOT NULL, NAME TEXT NOT NULL, SUBJECT TEXT NOT NULL, );CREATE TABLE … Read more

Detach Database in SQLite

SQLite Detach Database To detach the alias-named database from an attached database connection, the SQLite DETACH DATABASE statement is used. It only detaches a single alias at a time in case if the same database file has been attached with multiple aliases. However, this statement cannot detach the Main and temp databases. It destroys the … Read more

Attach Database in SQLite

SQLite Attach Database To select a particular database from multiple available databases, the SQLite ATTACH DATABASE statement is used. It allows the execution of all SQLite statements under the attached database. If the database is not already present, this statement creates the database. And in other cases, it only attaches a database with the logical … Read more