SQLite is a database engine. It does not require any server to process queries. It is a kind of software library that develops embedded software for television, smartphones, and so on. It can be used as a temporary dataset to get some data within the application due to its efficient nature. It is preferable for small datasets.
SQLite CREATE TABLE
SQLite CREATE TABLE is used to create a TABLE in a database. CREATE TABLE helps to create a table in the database with the name of the table and some columns defined in it with constraints, which stores some information. In SQLite, two tables can't be of the same name.
Syntax:
CREATE TABLE table_name
(column1 datatype KEY Constraints,
column2 datatype,
column3 datatype
.
.
.
columnN datatype)
Example 1:
Let's understand with the help of examples.
Query:
CREATE TABLE GeeksForGeeks
(emp_id varchar(255) PRIMARY KEY,
emp_name varchar(255),
dept varchar(255),
duration varchar(255))
Create GeeksForGeeks TableExplanation:
- In the above query, We have created a table called GeeksForGeeks with the help of CREATE TABLE , which contains the employee_id, employee name, department name, and duration of work.
- Here we also have used PRIMARY KEY Constraints. PRIMARY KEY ensures that every entry of data in the table is unique. that's why we implemented this onto employee_id because every employee has a unique ID in the organization.
Example 2:
Let's insert 2 records and check whether the table is created or not. If the table shows some information, it means our table is created and data is inserted into it otherwise it gives an error.
Query 1
INSERT INTO GeeksForGeeks VALUES(01,' Vipul', 'Content', '8 months');
INSERT INTO GeeksForGeeks VALUES(02, 'Deepesh', 'Mentor', '16 months');
Query 2
SELECT * FROM GeeksForGeeks
After performing INSERT Operation GeeksForGeeks Table Look Like
Explanation:
Since our table has been created that's why the above two INSERT Queries will execute and store the records in it. You can insert any number of records into the table after Creating it and perform any operation once the table has been created.
Conclusion
SQLite is a nimble and serverless database engine ideal for embedded systems and mobile applications. The CREATE TABLE statement allows for easy table creation, as demonstrated with the example of a table named "GeeksForGeeks." The use of PRIMARY KEY ensures unique employee IDs in the table.
Similar Reads
SQL CREATE TABLE In SQL, creating a table is one of the most essential tasks for structuring your database. The CREATE TABLE statement defines the structure of the database table, specifying column names, data types, and constraints such as PRIMARY KEY, NOT NULL, and CHECK. Mastering this statement is fundamental to
5 min read
MySQL CREATE TABLE Creating tables in MySQL is a fundamental task for organizing and managing data within a database. Tables act as structured containers, similar to spreadsheets, where data is stored in rows and columns. In this article, we will explore the process of creating tables in MySQL using both the Command L
4 min read
SQLite Alter Table SQLite is a serverless architecture that we use to develop embedded software for devices like televisions, cameras, and so on. It is written in C programming Language. It allows the programs to run without any configuration. In this article, we will learn everything about the ALTER TABLE command pre
4 min read
SQLite Describe Table SQLite is an embedded database that doesn't use a database like Oracle in the background to operate. It is written in C language and is used by developers who embed a lightweight database over the existing application, browser, or embedded systems. SQLite works on various platforms like Windows, Mac
8 min read
SQL RENAME TABLE Renaming a table is a common and useful operation for database administrators and developers. It is especially useful when we need to correct a naming mistake, organize our database schema, or update the table name to reflect new business requirements. In this article, we will provide a detailed gui
6 min read
PostgreSQL - CREATE TABLE In PostgreSQL, the CREATE TABLE statement is used to define a new table within a database. It allows us to specify the table's structure, including column names, data types, and constraints, ensuring data integrity and consistency. Understanding the PostgreSQL table creation process is essential for
5 min read
SQL ALTER TABLE The SQL ALTER TABLE statement is a powerful tool that allows you to modify the structure of an existing table in a database. Whether you're adding new columns, modifying existing ones, deleting columns, or renaming them, the ALTER TABLE statement enables you to make changes without losing the data s
5 min read
PL/SQL CREATE TABLE Statement PL/SQL CREATE TABLE statement is a fundamental aspect of database design and allows users to define the structure of new tables, including columns, data types, and constraints. This statement is crucial in organizing data effectively within a database and providing a blueprint for how data should be
3 min read
CREATE TABLE in SQL Server SQL Server provides a variety of data management tools such as querying, indexing, and transaction processing. It supports multiple programming languages and platforms, making it a versatile RDBMS for various applications. With its robust features and reliability, SQL Server is a popular choice for
4 min read
SQLite Show Tables SQLite is a lightweight database library written in C which is used for embedding the database with applications. SQLite is a serverless, lightweight, cross-platform, and highly reliable database engine that provides the standard SQL syntax making it easy to use standalone or integrate with any othe
8 min read