Setting Up a Table in SQLite

In order to perform operations, we need to create a table in our database first. We can simply create a table with below query.

Table : w3wiki

Query:

CREATE TABLE w3wiki (
id INTEGER PRIMARY KEY,
name TEXT,
rank INTEGER,
total_score INTEGER
);

Now, we have created a table, lets add some data to it and display it. We can simply add the data to our table with below query.

Query:

--Data Insertion

INSERT INTO w3wiki(id, name, rank, total_score)
VALUES(101,'Vishu',01,500);
INSERT INTO w3wiki(id, name, rank, total_score)
VALUES(102,'Aayush',02,400);
INSERT INTO w3wiki(id, name, rank, total_score)
VALUES(103,'Neeraj',03,450);
INSERT INTO w3wiki(id, name, rank, total_score)
VALUES(104,'Sumit',04,350);
INSERT INTO w3wiki(id, name, rank, total_score)
VALUES(105,'Vivek',05,200);

--Displaying our table's data

SELECT * From w3wiki;

Output:

Table – w3wiki

Now, we are are done with creating the table and inserting data to it. Lets move to some case based examples.

How to Set a Column Value to NULL in SQLite?

SQLite is a lightweight and self-contained relational database management system in short RDBMS. Its has a server-less architecture which makes it a better option for small desktop and mobile applications. It also requires very low configuration which eventually helps the developer to integrate it into any applications with great ease. In this article, we are going to explore the topic “how to set a column value to null“. We are going to explore all its required concepts with clear and concise examples.

Similar Reads

How to Set a Column Value to NULL in SQLite

To set a column value to NULL, we have to use an UPDATE statement. The update statement is specifically used in modifications of existing records in a table. We will be using an update statement to set a single column or multiple columns to NULL. We can also use the WHERE clause along with the UPDATE statement to selectively set specific rows’ column(s) to NULL....

Setting Up a Table in SQLite

In order to perform operations, we need to create a table in our database first. We can simply create a table with below query....

Example of How to Set a Column Value to NULL

Example 1: Setting a single column value to NULL...

Conclusion

SQLite is a light-weighted and has a server-less architecture. We can easily integrate it into any applications. In SQLite to set a column value to NULL , we have to use UPDATE statement for it. We can also use WHERE clause, if we want only some specific row’s column to have NULL value. We have covered its various example and real-life cases such as setting NULL values in a single column as well as in multiple columns. Now you have a good understanding on how to set a column value to NULL. Now you can easily perform queries related to it and can get the desired output....

Contact Us