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

Create Database in SQLite

SQLite Create Database To create a new database in SQLite, the sqlite3 command is used. Syntax: sqlite3 DatabaseName.db To create a database: Open the command prompt. Set the path. Check the SQLite directory. Command: dir Create a database. Example: sqlite3 example.db Check the created database. Command: .databases Or check the created database in the root … Read more

Expressions in SQLite

SQLite Expressions To evaluate the value, a combination of one or more values, operators and SQL functions can be used. These combinations are written in query language in SQLite and are called SQLite expressions. They are mostly used with the SQLite SELECT statement. Syntax: SELECT column_1, column_2, column_N FROM table_name WHERE [CONDITION | EXPRESSION]; Types … Read more

Operators in SQLite

SQLite Operators The reserved words or characters used in SQLite statements to perform operations on a variable, an expression or a value are called the SQLite Operators. It is used to specify conditions. It also acts as a conjunction for multiple conditions in a statement. SQLite facilitates four types of operators. These are:   Arithmetic … Read more

Data Types in SQLite

SQLite Data Types A more general dynamic type data type system is used in SQLite to represent the type of data that can be stored and processed and to specify the type of operations that can be performed. These data types are divided into various categories, where the value of a data type is not … Read more

SQLite Syntax

SQLite Syntax Rules for using SQLite Commands: Some SQLite commands are case sensitive. Comments in SQLite cannot be nested. Comments can be represented with two consecutive “-” characters or appears with “/*” and “*/” character pair.   SQLite Statements: All the SQLite statement ends with a semicolon (;). Below is a list of the SQLite … Read more

Commands in SQLite

SQLite Commands SQLite commands can be either of the three types:   1. Data Definition Language (DDL): It includes three commands: CREATE: To create a table, a view of a table or other object in the database. ALTER: To modify an existing database object like a table. DROP: To delete an entire table, a view … Read more