Composite Key – Multiple Primary Key
SQLite allows one primary key per table but we can define multiple primary keys in the form of Composite Key. Composite keys combine multiple columns and create unique identifier for each row.
CREATE TABLE GeekForGeeks (
emp_id varchar(255),
emp_name varchhar(255),
emp_city varchar(255),
em_dept varchar(255)
PRIMARY KEY (emp_id,emp_name)
)
Explanation: In the above query we combine (emp_id,emp_name) and make a composite key which acts as a PRIMARY KEY and esnure that only a Unique value will be stored.
SQLite Primary Key
SQLite is an open-source database system just like SQL database system. It is a lightweight and serverless architecture which means it does not require any server and administrator to run operations and queries. It is widely used by the developer to store the data within the applications. It is preferable for small datasets without much effort. It is used to develop embedded software and run on various operating systems like Windows, Mac OS, and Linux.