1CREATE TABLE `Donor`(
2 `did` int(50) NOT NULL,
3 `oid` int(50) NOT NULL,
4 `dname` varchar(50) NOT NULL,
5 `dblood` varchar(50) NOT NULL,
6 PRIMARY KEY (`did`, `oid`)
7);
1Primary Key :
2It is unique column in every table in a database
3It can ONLY accept;
4 - nonduplicate values
5 - cannot be NULL
6
7
8
9Foreign Key:
10It is a column that comes from a different table and
11using Foreign key tables are related each other
12It is the primary key of another table
13It can be duplicate or null for another table
14
15
16
17
18Unique Key:
19Only unique value and also can contain NULL
1PRIMARY KEY
2 -- unique identifier for the entire row of record in a table
3 -- can not be null and must be unique
1PRIMARY KEY -- unique identifier for the entire row of record in a table
2 -- can not be null and must be unique
1CREATE TABLE Persons (
2 Rollno int NOT NULL,
3 FirstName varchar(255),
4 LastName varchar(255),
5 Age int,
6 PRIMARY KEY (ID)
7);
8
1Primary Key :
2It is unique column in every table in a database
3It can ONLY accept;
4 - nonduplicate values
5 - cannot be NULL