I am beginner for Oracle. Please anyone can tell me how we can assign primary key in to a particular field???????
There are 2 ways to do it:
- as part of the create table statment like this
create table tab_1 (col1 number, col2 number, col3 number,
CONSTRAINT PK1 PRIMARY KEY (col1)) ;
- alter table tab_1 add CONSTRAINT PK1 PRIMARY KEY (col1) ;
As a beginner, it is absolutely essential that you obtain Oracle reference material. This system is not something that you learn as you go without wasting literally hundreds, probable thousands, of hours. Worse, you could easily create a collection of tables and views that run, but that do so so very slowly that you may find yourself starting over. Or believing that Oracle was a waste of time, which it is not.
Be assured: The manuals are needed. Personally, I have a CD from Oracle, "On-Line Generic Documentaion", that includes ALL the manuals (back at Oracle8, but I find little need for the more recent features :) )
I have a number of macros in my toolkit that I'd be happy to share, once you are at a level that could use them.
I don't wish to sound snotty, really; just advising you on what my learning experience, decades ago, taught me.
You just need to add a constraint for the purpose.
Post #2 should help you in defining all that.
Post 2 is quite a sufficient reply. it'll help you add constraint to the column