how to create a primary key with out creating an index?
Answers were Sorted based on User's Feedback
Answer / bhargavi
Primary key creates an Index implicitly.....so Its not
possible to create a Pk without am index....
| Is This Answer Correct ? | 16 Yes | 0 No |
Answer / vinoth
ALTER TABLE EMP ADD CONSTRAINT EMP_PK PRIMARY KEY(EMPNO)
DISABLE;
Primary key constraint is created and no index is created
since the constraint is disabled initially.
| Is This Answer Correct ? | 11 Yes | 0 No |
Answer / santanu
hi,
we can create pry key also by creating a sequence with NO
CYCLE option.
san
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / akshay
yes it possible using trigger
Create sequence S_Number
start with 1
increment by 1;
create trigger Pri_key before insert on table(C1)
for each row
Variable number(5);
begin
select sequence.nextvalue into Variable;
insert into table c1 value(variable);
end
| Is This Answer Correct ? | 3 Yes | 2 No |
Answer / anubha
The above trigger will give error of mutating table as in
this trigger you are doing dml operation on the triggering
table.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / priyankur
Unique constraint will always create non-clustered index on
column. so creation of Unique constraint is not the
solution. Yes, only sequence can create unique column but
that is not necessarily Primary key unless you treat it
likewise.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / benniyel gnanaraj
when u create a primary in the table the index is
implicitly create.index is not neccessary
| Is This Answer Correct ? | 0 Yes | 1 No |
What will happen after commit statement ?
write a query filter the null value data following source? name age john 30 smith null null 24 sharp 35 i want output name age john 30 sharp 35
What is the difference between local and global temporary table?
What is the fastest way of accessing a row in a table?
What are Global Temporary tables
What trigger means?
What does plvtab enables you to do when you showthe contents of pl/sql tables?
What is a left join?
What is audit logout in sql profiler?
Can you have a foreign key without a primary key?
What's the difference between inner join and left join?
what is difference between procedure and function, procedure and trigger?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)