0% found this document useful (0 votes)
42 views

Database Management System Vivek More Docs

The document discusses different types of keys in a database including primary keys, foreign keys, super keys and candidate keys. It provides examples to illustrate the concepts and differences between these keys.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Database Management System Vivek More Docs

The document discusses different types of keys in a database including primary keys, foreign keys, super keys and candidate keys. It provides examples to illustrate the concepts and differences between these keys.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

A

Micro project report On

“Information About Key’s In Database ”

SUBMITTED TO M.S.B.T.E., Mumbai

For the Award of


DIPLOMA IN INFORMATION TECHNOLOGY BY

Roll no Name of Student Enrollment no


53 Vivek More 2010740330
07 Digvijay Wadekar 2010740281
38 Shubham Deokar 2010740310
51 Tushar Mutkule 2010740328

UNDER THE GUIDANCE OF


Ms. Lokhande.D.T
.
DEPARTMENT OF INFORMATION TECHNOLOGY
NBA ACCREDIATED

SVERI’s College of Engineering (Polytechnic), Pandharpur


Gopalpur Pandharpur-413304
2021-22
AFFILIATED TO

M.S.B.T.E.
Evolution sheet for Micro Project

Academic Year:- 2021-22 Name of Faculty:- Ms.Vhawal H. N.


Course:- Information Technology Course code:- IF4I
Subject:-Database Management System Subject Code:- 22322
Semester:- 4 Scheme:- I

Title of Project:-

COs addressed by the Micro Project:

CO 1 Identify the process of Database management system.

Comments/Suggestions about team work/leadership/inter-personal communication (if any)

Marks out of 4
Marks out of 6 Total
for
for mars
Roll No Name of students performance
performance in out
in oral/
group activity of 10
Presentation

53 Vivek More
07 Digvijay Wadekar
38 Shubham Deokar
51 Tushar Mutkule

Name and
Signature of Ms.Vhawal H. N.
faculty
SVERI’s COLLEGE OF ENGINEERING (POLYTECHNIC), PANDHARPUR.

CERTIFICATE

This is to certify that the Project report entitled


Submitted by

Roll no Name of Student Enrollment no


53 Vivek More 2010740330
07 Digvijay Wadekar 2010740281
38 Shubham Deokar 2010740310
51 Tushar Mutkule 2010740328

is a bonafide work carried out by above students, under the


guidance of Ms. Lokhande.D.and it is submitted towards the
fulfillment of requirement of MSBTE, Mumbai for the award of
Diploma in Information Technology at SVERI’s COE
(Polytechnic), Pandharpur during the academic year 2021-2022

(Ms. Lokhande.D.T)

Guide
(Ms. Malgonde. R. K) (Dr. Misal N. D.)
HOD Principal

Place: Pandharpur

Date: / /
Acknowledgement

“ Information About Key’s In Database” has been developed successfully with a


great contribution of two students in a period of two months. We like to appreciate their
guidance, encouragement and willingness since without their support the project would
not have been a success. We would like to give our heartfelt gratitude to Principal Dr. N.
D. Misal , Guide Ms.Vhawal H.N. & HOD Ms.Malgonde.R.K, who is the supervisor of
our project for helping and encouraging us in many ways to make our project a success.
We would never been able to finish our work without great support and enthusiasm from
friends and support from our family. We would like to thank the department of
Information Technology, for giving us permission to initiate this project and successfully
finish it.
Introduction

 Constraints or nothing but the rules that are to be followed while entering


data into columns of the database table 
 Constraints ensure that data entered by the user into columns must be within
the criteria specified by the condition 
 For example, if you want to maintain only unique IDs in the employee table or if
you want to enter only age under 18 in the student table etc 
 We have 5 types of key constraints in DBMS
o NOT NULL: ensures that the specified column doesn’t contain a NULL
value.
o UNIQUE : provides a unique/distinct values to specified columns.
o DEFAULT: provides a default value to a column if none is specified.
o CHECK :checks for the predefined conditions before inserting the data
inside the table.
o PRIMARY KEY: it uniquely identifies a row in a table.
o FOREIGN KEY: ensures referential integrity of the relationship
Resources Used
Sr. No. Specification Remark
1 Intel Core i3/ i5, RAM 4GB As per requirement
2 Operating System – Windows 10 As per requirement
3 Application – Microsoft Word 2016 As per requirement
Advantages

1. Better Data Security


2. Minimized Data Inconsistency
3. Better decision making

COs addressed by the Micro Project:

CO 1 Understand the concept of key’s.


Methodology
Definition:
A primary key is a minimal set of attributes (columns) in a table that uniquely
identifies tuples (rows) in that table.
Primary Key Example in DBMS
Lets take an example to understand the concept of primary key. In the following table, there
are three attributes: Stu_ID, Stu_Name & Stu_Age. Out of these three attributes, one attribute
or a set of more than one attributes can be a primary key.

Attribute Stu_Name alone cannot be a primary key as more than one students can have
same name.

Attribute Stu_Age alone cannot be a primary key as more than one students can have same
age.

Attribute Stu_Id alone is a primary key as each student has a unique id that can identify the
student record in the table.

Note: In some cases an attribute alone cannot uniquely identify a record in a table, in that
case we try to find a set of attributes that can uniquely identify a row in table. We will see the
example of it after this example.
SUPER KEY:
Definition of Super Key in DBMS: A super key is a set of one or more attributes
(columns), which can uniquely identify a row in a table. Often DBMS beginners get confused
between super key and candidate key, so we will also discuss candidate key and its relation
with super key in this article.
How candidate key is different from super key?
Answer is simple – Candidate keys are selected from the set of super keys, the only thing we
take care while selecting candidate key is: It should not have any redundant attribute. That’s
the reason they are also termed as minimal super key.

Let’s take an example to understand this:

Super keys: The above table has following super keys. All of the following sets of super key
are able to uniquely identify a row of the employee table.

 {Emp_SSN}
 {Emp_Number}
 {Emp_SSN, Emp_Number}
 {Emp_SSN, Emp_Name}
 {Emp_SSN, Emp_Number, Emp_Name}
 {Emp_Number, Emp_Name}

Candidate Key in DBMS


Definition of Candidate Key in DBMS: A super key with no redundant attribute is
known as candidate key. Candidate keys are selected from the set of super keys, the
only thing we take care while selecting candidate key is that the candidate key should
not have any redundant attributes. That’s the reason they are also termed as minimal
super key.

Candidate Key Example


Lets take an example of table “Employee”. This table has three attributes: Emp_Id,
Emp_Number & Emp_Name. Here Emp_Id & Emp_Number will be having unique values
and Emp_Name can have duplicate values as more than one employees can have same
name.

How many super keys the above table can have?


1. {Emp_Id}
2. {Emp_Number}
3. {Emp_Id, Emp_Number}
4. {Emp_Id, Emp_Name}
5. {Emp_Id, Emp_Number, Emp_Name}
6. {Emp_Number, Emp_Name}

Lets select the candidate keys from the above set of super keys.

1. {Emp_Id} – No redundant attributes


2. {Emp_Number} – No redundant attributes
3. {Emp_Id, Emp_Number} – Redundant attribute. Either of those attributes can be a
minimal super key as both of these columns have unique values.
4. {Emp_Id, Emp_Name} – Redundant attribute Emp_Name.
5. {Emp_Id, Emp_Number, Emp_Name} – Redundant attributes. Emp_Id or Emp_Number
alone are sufficient enough to uniquely identify a row of Employee table.
6. {Emp_Number, Emp_Name} – Redundant attribute Emp_Name.

Foreign key in DBMS


Definition: Foreign keys are the columns of a table that points to the primary key of
another table. They act as a cross-reference between tables.
Composite key in DBMS
Definition of Composite key: A key that has more than one attributes is known as
composite key. It is also known as compound key.

Note: Any key such as super key, primary key, candidate key etc. can be called composite
key if it has more than one attributes.
Composite key Example
Lets consider a table Sales. This table has four columns (attributes) – cust_Id, order_Id,
product_code & product_count.

Alternate key in DBMS


As we have seen in the candidate key guide that a table can have multiple candidate
keys. Among these candidate keys, only one key gets selected as primary key, the
remaining keys are known as alternative or secondary keys.

Alternate Key Example


Lets take an example to understand the alternate key concept. Here we have a table
Employee, this table has three attributes: Emp_Id, Emp_Number & Emp_Name.

There are two candidate keys in the above table:


{Emp_Id}
{Emp_Number}

DBA (Database administrator) can choose any of the above key as primary key. Lets say
Emp_Id is chosen as primary key.

Since we have selected Emp_Id as primary key, the remaining key Emp_Number would be


called alternative or secondary key.
Conclusion
SQL constraints limit the type of values that can be stored in a column. There are
six main constraints in SQL: PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL,
DEFAULT, and CHECK.

References
Alternate key in DBMS (beginnersbook.com)
Advantages of Database Management System - GeeksforGeeks
Types of constraints - IBM Documentation

You might also like