You are on page 1of 4

what is the difference between primary key & foreign key?

Answer Primary keys enforce entity integrity by uniquely


#1
identifying entity instances. Foreign keys enforce
referential integrity by completing an association
between
Two entities.
what is the difference between primary key & foreign key?
Answer Primary key is unique key but foreign key always refers
#2
to
primary key
what is the difference between primary key & foreign key?
Answer Primary key is unique
#3
primary key is not NULL and
foreign key is NULL
foreign key reference as Primary key in another table

what is the difference between primary key & foreign key?


Answer Primary Key is unique Key entire the table and which is
#4
also NOT NULL
where as foriegn key is the null & which references the
primary key .

what is the difference between primary key & foreign key?


Answer
primary key is the parent and foreign is the child.
#5

what is the difference between primary key & foreign key?


Answer primary key is used to identify a row and it doesnot allow
#6
null values. It avoids duplication of rows.
whereas foreign key refers to a column or combination of
columns included in the defenition of referential integrity.
what is the difference between primary key & foreign key?
Answer In the context of relational databases, a foreign key is a
#7
referential constraint between two tables.[1] The foreign
key identifies a column or a set of columns in one
(referencing) table that refers to a column or set of
columns in another (referenced) table. The columns in
the
referencing table must form a primary key or unique key.
what is the difference between primary key & foreign key?
Answer Basic difference between Primary key and foreign key is :
#8
Primary key will not allow "Null values" and "Duplicate
values"

Foreign key will allow "Null values" and "Duplicate


values"
and it refers to a primary key in another table.
what is the difference between primary key & foreign key?
Answer primary key is used to identify a row and it doesnot allow
#9
null values. It avoids duplication of rows.
whereas foreign key refers to a column or combination of
columns included in the defenition of referential integrity.
what is the difference between primary key & foreign key?
Answer Primary key is used to identify a row in a table and it
# 10
doesnot allow null values. It avoids duplication of rows.
whereas foreign key refers to a column or combination of
columns included in the defenition of referential integrity

what is the difference between primary key & foreign key?


Answer foreign key is NULL
# 11
foreign key reference as Primary key in another table
Primary key is unique
primary key is not NULL and

what is the difference between primary key & foreign key?


Answer primary key is a keyword .that refers to the unique
# 12
value
in the particular record.it cant have null
foreign key is always keyword that refers primary key.it
has
null value.its refers to another table

what is the difference between primary key & foreign key?


Answer foregin key reference a primary key in another table
# 13
and primary key is used to identify a row.
what is the difference between primary key & foreign key?
Answer primary key does not allow duplicate and null values
# 14
but foreign key allows null values it refers primary key

what is the difference between primary key & foreign key?


Answer primary key is a constraint key that can not contain a

# 15

null
or duplicate values.
foriegn key is a reference key ,before referencing the
foriegn key parent table field or fields must have primary
key.If u can try to insert a value in referencing field,new
record that must contain parent field

what is the difference between primary key & foreign key?


Answer primary key is the unique value,but its not nul values..
# 16
this kry is avoided dublicate values
foreign key is always references the primary key.

what is the difference between primary key & foreign key?


Answer Primary is unique one. Each table has only one primary
# 17
key.
But not allow null values.
Foreign key is opposite of primary. It is reference of
primary key from another table. It allow Null value. Each
table can have more than one foreign key.
Foreign key is used to link one to another table.

what is the difference between primary key & foreign key?


Answer primary key of a relation is a candidate key that has
# 18
been
designated as the main key.It doesn't has null value.
A foreign key is an attribute in a relation that can be
used as a key to another relation.It allow null and
duplicate value.

what is the difference between primary key & foreign key?


Answer Foreign key = Florida Keys (Keys in a foreign land)
# 19
Primary Key = The main key you use to enter you home

what is the difference between primary key & foreign key?


Answer Primary key is a keyword.
# 23
It should not have null value and duplicate value.
We can have only one primary key in a table and the
value
should be unique.
Foreign key is a keyword.
It can have null value and duplicate value.
We can have more than one foreign key for a table and
this

froeign key table references the primary key table


what is the difference between primary key & foreign key?
Answer A primary key is an combination of attributes that
# 25
uniquely
identifies each row in a relation. A primary key is
designated by underlining the attribute name. The
primary
key of an entity set allows us to distinguish among the
various entities of the set.
A foreign key is an attribute in a relation of database
that serves as the primary key of another relation in the
same database.

Foreign Key
A foreign key is a field (or fields) that points to the primary key of another table. The
purpose of the foreign key is to ensure referential integrity of the data. In other words, only
values that are supposed to appear in the database are permitted.
For example, say we have two tables, a CUSTOMER table that includes all customer data, and an
ORDERS table that includes all customer orders. The constraint here is that all orders must be
associated with a customer that is already in the CUSTOMER table. In this case, we will place a
foreign key on the ORDERS table and have it relate to the primary key of the CUSTOMER table.
This way, we can ensure that all orders in the ORDERS table are related to a customer in the
CUSTOMER table. In other words, the ORDERS table cannot contain information on a customer
that is not in the CUSTOMER table.
primary key
The primary key of a relational table uniquely identifies each record in the table. It can either
be a normal attribute that is guaranteed to be unique (such as Social Security Number in a
table with no more than one record per person) or it can be generated by the DBMS (such as a
globally unique identifier, or GUID, in Microsoft SQL Server). Primary keys may consist of a
single attribute or multiple attributes in combination.

Candidate Key
-- A candidate key is a combination of attributes that can be uniquely used to identify a
database record without any extraneous data. Each table may have one or more candidate
keys. One of these candidate keys is selected as the table primary key.
What is Normalization?
Normalization is the process of efficiently organizing data in a database. There are
two goals of the normalization process: eliminating redundant data (for
example, storing the same data in more than one table) and ensuring data
dependencies make sense (only storing related data in a table). Both of these
are worthy goals as they reduce the amount of space a database consumes and
ensure that data is logically stored.

You might also like