In any table to avoid chaos or confusion we shold always select one primary key. primary key is used to identify each row distinctly, means when u say studid 6, you will find row with studid id 6 easily,
But if you same studname abc, then you will not able to decide which record to refer, 1 or 6.
Here In table batchmaster
we select batchid as primary key and in studentmaster we select studid as PK
It is used to refer details of other table to avoid duplicate entries. To mention batch for rms we only refer to its batch id and not whole batchname.
so batchid column in studentmaster table is know as foreign key as its details are found in some foreign table, we just store reference to it
Some time in table you will need row values to be unique like emailid, userid like that. but you already have one primary key i n studentmaster so, we will set emailid to unique key.
Unique key help us to avoid entry of duplicate email ids in studentmaster
note primary keys are always unique keys
unique keys are NOT always PRIMARY KEYS