Please help me how to write a Query to change the primary
key constraint from 1 attribute to another attribute in a
table
Answers were Sorted based on User's Feedback
Answer / dinesh a.
You can assing only one primary key on a table , so you
can't modify directoly one column to another , you need to
drop first one then create on another attribute.
SQL>ct constraint_name,constraint_type from user_constraints
where table_name='EMP' and constraint_type='P';
CONSTRAINT_NAME C
------------------------------ -
SYS_C00125220 P
SQL> alter table emp drop constraint SYS_C00125220;
sql> alter table any_table add constraint my_cons_nm
primary key(column_of_tab)
| Is This Answer Correct ? | 6 Yes | 1 No |
Answer / chandana
YOU CANNOT CHANGE THE CONSTRAINTS DIRECTLY ON A COLUMN.
FIRST DROP THE CONSTARINT U HAVE CREATED AND THEN USE ALTER
COMMAND TO ADD CONSTARINT TO THE CORRECT COLUMN.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / manvendra
ALTER TABLE TABLE_NAME
MODIFY COLUMN (COLUMN2 PRIMARY KEY);
| Is This Answer Correct ? | 1 Yes | 5 No |
Define Normalization with example?
How do I manually uninstall oracle client?
Does oracle charge for java?
Suppose U install the oracle DB either enterprise edition or express edition in ur personal PC, Is there the Database has been created after ur installation if not then where the oracle's all objects with data be stored?
how to create a new database in oracle?
What is archive log in Oracle?
How to convert characters to dates in oracle?
Describe the different type of Integrity Constraints supported by ORACLE ?
what happened to the global index when I truncate the data in one of the partition?
how to make an oracle object
HOW TO DISPLAY MAXIMUM SALARIES FROM EMP DEPARTMENT VISE ALONG WITH DEPARTMENT NAMES? E.g EMP,DEPT
5 Answers College School Exams Tests, DELL,
what are views?