Home » SQL & PL/SQL » SQL & PL/SQL » How to create/use composite keys.
icon2.gif  How to create/use composite keys. [message #209682] Sat, 16 December 2006 13:56 Go to next message
lunate
Messages: 74
Registered: October 2006
Location: Pakistan
Member

hi all.
i think my problem is very simple but at this time my mind is fed-up with this cute white screen of oracle data base. Laughing

if it is possible to define composite keys in oracle database as in sql server.
can some one help me i want to defien/use /create composite key in my table.(as we use composite keys in sql server).

suppose the table is.

create table lunate(
no number primary key,
name char(15) -- also as primary key(composite key).

add varchar2(15));


so please tell me how i can make no,name both as composite keys in the above table in oracle.
regards.
Re: How to create/use composite keys. [message #209686 is a reply to message #209682] Sat, 16 December 2006 15:45 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
>so please tell me how i can make no,name both as composite keys in the above table in oracle.
You need to be willing and capable of reading the fine SQL Reference Manual found at http://tahiti.oracle.com
Re: How to create/use composite keys. [message #209870 is a reply to message #209682] Mon, 18 December 2006 04:11 Go to previous message
venurajkumar
Messages: 4
Registered: December 2006
Location: chennai
Junior Member
Example : which you have given

create table lunate(
no number primary key,
name char(15) -- also as primary key(composite key).
add varchar2(15));

To create a composite key
create table lunate(
no number ,
name char(15),
add varchar2(15),constraint lunate_pk primary key (no,name));
This is how you can define a composite key
Previous Topic: how to find previous day
Next Topic: avg() function
Goto Forum:
  


Current Time: Sat Dec 03 07:54:00 CST 2016

Total time taken to generate the page: 0.09897 seconds