Syntax to Create Composite Key in mySQL
CREATE TABLE Orders
(
Customer_id INT,
Product_id INT,
Quantity INT,
PRIMARY KEY (Customer_id, Product_id)
);
Composite Key in Database
A database is a structured collection of data organized and stored electronically in a computer system. It is designed to efficiently manage, retrieve, and manipulate large volumes of data according to specific requirements and criteria.
In a relational database, the key plays an important role. The key is used to identify a record or a tuple of the table uniquely. Keys are also used to establish and identify the relationships between the tables.
Contact Us