1,334 views
1 votes
1 votes
Which of the following statement is true?
(a) Primary key constraint cannot be disabled, it can
only be dropped.
(b) Primary key constraint cannot be disabled and
dropped.
(c) Primary key constraint can be disabled and can
be dropped.
(d) None of the above

1 Answer

1 votes
1 votes

Answer - (C)

Drop Primary Key.

We can not directly drop P.K. as

ALTER TABLE Table1
DROP PRIMARY KEY

Because it will show some kind of Error like,

Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword ‘PRIMARY’.


If we want to drop primary key constraint in SQL Server, run the following query.
 

ALTER TABLE Table1
DROP CONSTRAINT PK_Table1_Col1

 

Disabling Primary Key.

You can disable a primary key in Oracle using the ALTER TABLE statement.

Syntax

The syntax to disable a primary key using the ALTER TABLE statement in Oracle/PLSQL is:

ALTER TABLE table_name
DISABLE CONSTRAINT constraint_name;

Related questions

0 votes
0 votes
1 answer
1
Brij gopal Dixit 1 asked Jul 29, 2018
405 views
If a primary Key consist of multiple attributes/fields then can it possible that one of the attribute/field have NULL values???For Example ->If a Relation R(A,B,C) have p...
0 votes
0 votes
0 answers
2
tanwardivya asked Jan 11, 2017
214 views
4 votes
4 votes
2 answers
3
debanjan sarkar asked Oct 1, 2016
2,631 views
Can we allow NULL value in some attribute of primary key, if primary key contains more than one attribute?
0 votes
0 votes
3 answers
4
Sanjay Sharma asked Jun 17, 2016
2,751 views
A primary key for an entity isa candidate keyany attributea unique attributea superkey