2-Functional Dependency Lyst6356

Download as pdf or txt
Download as pdf or txt
You are on page 1of 71

Key

To access all paid content get KG Prime at ₹25/day CLICK HERE


To Find a candidate key of a Relation

• For identifying the uniqueness of a tuple, we take help of an attribute or set of


attributes. Uniqueness of tuple is needed as a Relation is a Set and Set disallows
duplicity of elements.

• Various Keys used in database System are as follows-

To access all paid content get KG Prime at ₹25/day CLICK HERE


Super key
• Set of attributes using which we can identify each tuple uniquely is called Super key, i.e. the
set of attributes used to differentiate each tuple of a relation.

• Let X be a set of attributes in a Relation R , if X+(Closure of X) determines all attributes of R


then X is said to be Super key of R .

• There should be at least one Super key with Not Null constraint.

To access all paid content get KG Prime at ₹25/day CLICK HERE


Super key

To access all paid content get KG Prime at ₹25/day CLICK HERE


• A relation of ‘n’ attributes with every attribute being a super key, then there are 2n -1

• Biggest Super Key possible in a Relation is a Set comprising all attributes of a Relation

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q The maximum number of super keys for the relation schema R(E, F, G, H) with E
as the key is (Gate-2014) (1 Marks)

a) 5
E F G H
b) 6

c) 7

d) 8

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q A super key for an entity consists of: (NET-JUNE-2008)
(A) one attribute only (B) at least two attributes
(C) at most two attributes (D) one or more attributes

To access all paid content get KG Prime at ₹25/day CLICK HERE


To access all paid content get KG Prime at ₹25/day CLICK HERE
Super key Candidate key

To access all paid content get KG Prime at ₹25/day CLICK HERE


Candidate key
1. Minimum set of attributes that differentiates the tuple of a Relation. No proper subset as
super key Also called as MINIMAL SUPER KEY.

2. There should be at least one candidate key with Not Null constraint.

To access all paid content get KG Prime at ₹25/day CLICK HERE


Prime attribute - Attributes that are member of candidate Keys are
called Prime attributes

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q (NET-JUNE-2019)

To access all paid content get KG Prime at ₹25/day CLICK HERE


To access all paid content get KG Prime at ₹25/day CLICK HERE
Primary key
1. One of the candidate keys is selected by database administrator as a Primary
Key.

2. Primary Key attribute are not allowed to have Null values.

3. At most one Primary Key per table is allowed in RDMS.

4. Candidate key which are not chosen as primary key is alternate key.

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Which one is correct w.r.t. RDBMS? (NET-JAN-2017)
(a) primary key ⊆ super key ⊆ candidate key
(b) primary key ⊆ candidate key ⊆ super key
(c) super key ⊆ candidate key ⊆ primary key
(d) super key ⊆ primary key ⊆ candidate key

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Which of the following is NOT a superkey in a relational schema with attributes
V, W, X, Y, Z and primary key VY? (GATE – 2016) (1 Marks)
(a) VXYZ (b) VWXZ (c) VWXY (d) VWXYZ

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Consider the following database table having A, B, C and D as its four attributes and four possible
candidate keys (I, II, III and IV) for this table: (NET-JULY-2016)

I: {B}

II: {B, C}

III: {A, D}

IV: {C, D}

If different symbols stand for different values in the table (e.g., d1 is definitely not equal to d2), then which
of the above could not be the candidate key for the database table?
(a) I and III only
(b) III and IV only
(c) II only
(d) I only

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q A primary key for an entity is: (NET-DEC-2007)
(A) a candidate key (B) any attribute
(C) a unique attribute (D) a super key

To access all paid content get KG Prime at ₹25/day CLICK HERE


To access all paid content get KG Prime at ₹25/day CLICK HERE
Foreign Keys
• A foreign key is a column or group of columns in a relational database table that refers the
primary key of the same table or some other table to represent relationship.

• The concept of referential integrity is derived from foreign key theory.

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Let R1(a, b, c) and R2(x, y, z) be two relations in which a is the foreign key of R1 that
refers to the primary key of R2. Consider following four options. (NET-JULY-2018)
(a) Insert into R1 (b) Insert into R2
(c) Delete from R1 (d) Delete from R2
Which of the following is correct about the referential integrity constraint with respect to
above?
(a) Operations (a) and (b) will cause violation.
(b) Operations (b) and (c) will cause violation.
(c) Operations (c) and (d) will cause violation.
(d) Operations (d) and (a) will cause violation.

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q A many-to-one relationship exists between entity sets r1 and r2. How will it be
represented using functional dependencies if Pk(r) denotes the primary key attribute of
relation r ? (NET-JULY-2018)
(a) Pk(r1) → Pk(r2)

(b) Pk(r2) → Pk(r1)

(c) Pk(r2) → Pk(r1) and Pk(r1) → Pk(r2)

(d) Pk(r2) → Pk(r1) or Pk(r1) → Pk(r2)

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Let pk(R) denotes primary key of relation R. A many-to-one relationship that
exists between two relations R1 and R2 can be expressed as follows: (NET-JAN-
2017)
(a) pk(R2) → pk(R1)

(b) pk(R1) → pk(R2)

(c) pk(R2) → R1 ∩ R2

(d) pk(R1) → R1 ∩ R2

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Consider the following tables T1 and T2. In table T1, P is the primary
key and Q is the foreign key referencing R in table T2 with on-delete
cascade and on-update cascade. In table T2, R is the primary key and
S is the foreign key referencing P in table T1 with on-delete set NULL
and on-update cascade. In order to delete record 〈3,8〉 from table T1,
the number of additional records that need to be deleted from table
T1 is _________. (GATE- 2017) (1 Marks)

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Drop Table cannot be used to drop a Table referenced by __________ constraint. (NET-JUNE-
2015)
(1)Primary key (2)Sub key (3)Super key (4)Foreign key

(a)(1)

(b)(1), (2) and (3)

(c)(4)

(d)(1) and (4)

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Referential integrity is directly relating to (NET-DEC-2012)
(A) Relation key (B) Foreign key
(C) Primary key (D) Candidate key

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q A recursive foreign key is a: (NET-JUNE-2007)
(A) references a relation (B) references a table
(C) references its own relation (D) references a foreign key

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q The following table has two attributes A and C where A is the primary key and C is the
foreign key referencing A with on-delete cascade.
The set of all tuples that must be additionally deleted to preserve referential integrity
when the tuple (2,4) is deleted is: (Gate-2005) (2 Marks)
a) (3,4) and (6,4) b) (5,2) and (7,2)
c) (5,2),(7,2) and (9,5) d) (3,4),(4,3) and (6,4)

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Consider the following table consisting of two attributes A and B, where ‘B’ is the A B
foreign key referring the candidate key ‘A’ with on – delete cascade option. When we 8 9
delete the tuple (3 2), we need to delete few tuples additionally in order to preserve the 4 6
referential integrity. The number of tuples that are remaining in the table when we 7 6
delete (3 2) and additional tuples if necessary is ______ 3 2
6 5
5 1
1 2
2 3

To access all paid content get KG Prime at ₹25/day CLICK HERE


• Composite key – Composite key is a key composed of more than one column
sometimes it is also known as concatenated key.

To access all paid content get KG Prime at ₹25/day CLICK HERE


• Secondary key – Secondary key is a key used to speed up the search and retrieval
contrary to primary key, a secondary key does not necessary contain unique
values.

To access all paid content get KG Prime at ₹25/day CLICK HERE


To access all paid content get KG Prime at ₹25/day CLICK HERE
Q R(ABCD)

A→B A B C D
B→C

C→A

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCD)

AB → CD A B C D

D→A

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDEF)

AB → C A B C D E F
C→D

B → AE

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABC)

AB → C A B C
C→A

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDEFGHIJ)

AB → C A B C D E F G H I J
A → DE

B→F

F → GH

D → IJ

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDEFGHIJ)

AB → C
A B C D E F G H I J
AD → GH

BD → EF

A→I

H→J

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDE)

CE → D A B C D E
D→B

C→A

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDEFGH)

A → BC A B C D E F G H
ABE → CDGH

C → GD

D→G

E→F
To access all paid content get KG Prime at ₹25/day CLICK HERE
Q R(ABCDE)

A→B A B C D E

BC → E

DE → A

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCD)

AB → CD A B C D
C→A

D→B

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDE)

A→B A B C D E
BC → E

DE → A

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDE)

AB → CD A B C D E
D→A

BC → DE

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDE)

BC → ADE A B C D E
D→B

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDEF)

AB → C A B C D E F
DC → AE

E→F

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDEF)

AB → C A B C D E F
C→D

D → BE

E→F

F→A
To access all paid content get KG Prime at ₹25/day CLICK HERE
Q R(WXYZ)

Z→W W X Y Z
Y → XZ

XW → Y

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(VWXYZ)

Z→Y V W X Y Z

Y→Z

X → YV

VW → X

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDEF)

ABC → D A B C D E F
ABD → E

CD → F

CDF → B

BF → D

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDE)

A → BC A B C D E

CD → E

B→D

E→A

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q R(ABCDEF)

A → BCDEF A B C D E F

BC → ADEF

DEF → ABC

To access all paid content get KG Prime at ₹25/day CLICK HERE


To access all paid content get KG Prime at ₹25/day CLICK HERE
Q (NET-DEC-2018)

A B C D E F
a) AE and BE

b) AE, BE and DE

c) AEF, BEF and BCF

d) AEF, BEF and DEF

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Match the following with respect to RDBMS: (NET-NOV-2017)

List-I List-II
(1) Entity integrity (i) enforces some specific business rule that do not fall into entity or domain
(2) Domain integrity (ii) Rows can’t be deleted which are used by other records
(3) Referential integrity (iii) enforces valid entries for a column
(4) User defined integrity (iv) No duplicate rows in a table

(1) (2) (3) (4)


a) iii iv i ii
b) iv iii ii i
c) iv ii iii i
d) ii iii iv i

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q In RDBMS, the constraint that no key attribute (column) may be NULL is referred
to as: (NET-JULY-2016)
(a) Referential integrity (b) Multi-valued dependency
(c) Entity Integrity (d) Functional dependency

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q A relation R = {A, B, C, D, E, F, G} is given with following set of functional
dependencies: F = {AD → E, BE → F, B → C, AF → G} Which of the following is a
candidate key? (NET-DEC-2015)
(a) A

(b) AB
A B C D E F G

(c) ABC

(d) ABD

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Find the candidate key(s) of the relation R(UVWXYZ) with FD set
F = {UV →W, XW → Y, U→ XZ, Y → U} (NET-DEC-2015)

a) XW

b) UV, YV and WXV U V W X Y Z

c) YUV, XV and WV

d) None of these

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Let R = {A, B, C, D, E, F} be a relation schema with the following dependencies
C → F, E → A, EC → D, A → B
Which of the following is a key for R? (NET-DEC-2014)
(A) CD

(B) EC A B C D E F

(C) AE

(D) AC

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Identify the minimal key for relational scheme R(A, B, C, D, E) with functional dependencies
F = {A → B, B → C, AC → D} (NET-DEC-2014)

(A) A

(B) AE
A B C D E

(C) BE

(D) CE

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Consider the relation scheme R = {E, F, G, H, I, J, K, L, M, N} and the set of functional
dependencies {{E, F} → {G}, {F} → {I, J}, {E, H} → {K, L}, K → {M}, L → {N} on R.
What is the key for R? (GATE- 2014) (1 Marks)

A) {E, F}
E F G I J K L M N
B) {E, F, H}

C) {E, F, H, K, L}

D) {E}

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Given the STUDENTS relation as shown below.

For (StudentName, StudentAge) to be the key for this instance, the value X should
not be equal to______________ (GATE- 2014) (1 Marks)

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values. F = {CH → G,
A → BC, B → CFH, E → A, F → EG} is a set of functional dependencies (FDs) so that F+ is exactly
the set of FDs that hold for R. How many candidate keys does the relation R have? (GATE- 2013)
(2 Marks)
(A) 3

(B) 4
A B C D E F G H

(C) 5

(D) 6

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q _______ constraints ensure that a value that appears in one relation for a given
set of attributes also appears for a certain set of attributes in another relation.
(NET-SEP-2013)
(A) Logical Integrity (B) Referential Integrity
(C) Domain Integrity (D) Data Integrity

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q The student marks should not be greater than 100. This is (NET-DEC-2013)
(A) Integrity constraint (B) Referential constraint
(C) Over-defined constraint (D) Feasible constraint

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Consider a relational table with a single record for each registered student with the following attributes.
1. Registration_Num: Unique registration number of each registered student
2. UID: Unique identity number, unique at the national level for each citizen
3. BankAccount_Num: Unique account number at the bank. A student can have multiple
accounts or join accounts. This attribute stores the primary account number.
4. Name: Name of the student
5. Hostel_Room: Room number of the hostel
Which one of the following option is INCORRECT? (GATE- 2011) (1 Marks)

A) BankAccount_Num is candidate key


B) Registration_Num can be a primary key
C) UID is candidate key if all students are from the same country
D) If S is a superkey such that S∩UID is NULL then S∪UID is also a superkey

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Match the following: (NET-DEC-2009)

List-I List-II
(1) Determinants (a) No attribute can be added
(2) Candidate key (b) Uniquely identified a row
(3) Non-redundancy (c) A constraint between two attributes
(4) Functional dependency (d) Group of attributes on the left-hand side of arrow of function dependency.

(A) 1 – d, 2 – b, 3 – a, 4 – c (B) 2 – d, 3 – a, 1 – b, 4 – c
(C) 4 – a, 3 – b, 2 – c, 1 – d (D) 3 – a, 4 – b, 1 – c, 2 – d

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q A relation R = {A, B, C, D, E, F} is given with following set of functional dependencies:
F = {A→B, AD→C, B→F, A→E}
Which of the following is candidate key? (NET-JUNE-2006)

(A) A

(B) AC
A B C D E F

(C) AD

(D) None of these

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Consider a relation scheme R = (A, B, C, D, E, H) on which the following
functional dependencies hold: {A → B, BC → D, E → C, D → A}. What are the
candidate keys of R? (GATE- 2005) (1 Marks)

(A) AE, BE

A B C D E H
(B) AE, BE, DE

(C) AEH, BEH, BCH

(D) AEH, BEH, DEH

To access all paid content get KG Prime at ₹25/day CLICK HERE


Q Given a relation R(A,B,C,D,E,F) and set of functional dependency (FD)
F = {A →BC, C → E, E → F, F → AB,}. How many candidate keys does the relation R
have?
a) 1

A B C D E F
b) 3

c) 4

d) 5

To access all paid content get KG Prime at ₹25/day CLICK HERE


(GATE-2021)

To access all paid content get KG Prime at ₹25/day CLICK HERE

You might also like