Answer Posted / srikanth
A composite key is used to club primary key for more than
once column.
PRIMARY KEY(<<COLUMN1>>,<<COLUMN2>>....<<COLUMNN>>)
But the disadvantage is that it will allow duplicates for
any one of the fields.
Example:
CREATE TABLE Example1
(Id INT NOT NULL,Pername VARCHAR(20) NULL,Phno INT NOT NULL
PRIMARY KEY(Id,Phno)
)
Command(s) completed successfully.
INSERT INTO Example1
VALUES(1,'sri',1111)
(1 row(s) affected)
INSERT INTO Example1
VALUES(1,'sri',6666)
(1 row(s) affected)
SELECT * FROM Example1
Id Pername Phno
1 sri 1111
1 sri 6666
As you can see that it is allowing same Id.
Basically Composite Key will take all the fields defined as
a group.So it is least bothered about any one of the field.
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
How many data types are supported?
What is an Oracle Instance?
Explain database link?
How to assign values to variables?
What is varray?
What is index in Oracle?
How to experiment a data lock in oracle?
How will you differentiate between varchar & varchar2?
How to create additional tablespaces for an new database?
What do you mean by a database transaction & what all tcl statements are available in oracle?
Database is hung. Old and new user connections alike hang on impact. What do you do? Your SYS SQLPLUS session IS able to connect.
Is oracle an open source?
What operating systems are supported by oracle database 10g xe?
What do you mean by group by clause?
What is oracle host variable?