primary key in dbms code example

Example 1: how to make multiple keys as primary in bdms

CREATE TABLE `Donor`(
  `did` int(50) NOT NULL,
  `oid` int(50) NOT NULL,
  `dname` varchar(50) NOT NULL,
  `dblood` varchar(50) NOT NULL,
  PRIMARY KEY (`did`, `oid`)
);

Example 2: primary key in sql

The PRIMARY KEY constraint uniquely identifies each record in a table.
Primary keys must contain UNIQUE values, and cannot contain NULL values. 
A table can have only ONE primary key; and in the table, this primary key can consist of single or multiple columns (fields).

Example 3: primary key in sql

Primary Key :
It is unique column in every table in a database
It can ONLY accept;
    - nonduplicate values
    - cannot be NULL

Tags:

Sql Example