Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Can a table have two primary keys?

Answers were Sorted based on User's Feedback



Can a table have two primary keys?..

Answer / vineet

A Table can have only one primary key but it is possible to
have more than 1 primary key attributes i.e candidate key.

Is This Answer Correct ?    1 Yes 0 No

Can a table have two primary keys?..

Answer / avdhesh

One Table can contain only One Pk But can Have more than One
Unique Key

Is This Answer Correct ?    1 Yes 0 No

Can a table have two primary keys?..

Answer / balaji

a table can have only one primary key.
u can make another primary key
that is called a composite primary key

Is This Answer Correct ?    1 Yes 0 No

Can a table have two primary keys?..

Answer / saurabh

No, a table can have one and only one primary key.

Is This Answer Correct ?    1 Yes 1 No

Can a table have two primary keys?..

Answer / sandeep gogoi

yes! it possibly have 2 primary keys as a combination of
such keys should not repeated!...

Is This Answer Correct ?    1 Yes 1 No

Can a table have two primary keys?..

Answer / uhaish

Yes and it can and the number of primary keys in a single
table is not limited and can be 3,4, unlimited .The concept
is imagine 2 primary keys cols in a table as one primary
key col .
which means if you have two cols A and B both are primary
key by defination then..
AB
00
01
02
12
21
21
22

,see individually a primary key col is not anymore unique
but as hole its unique no other row in a table can have the
same combination of these two primary keys i.e '02' cannot
be repeated .

Is This Answer Correct ?    2 Yes 2 No

Can a table have two primary keys?..

Answer / murali krishna penke

we can create more than one primary key in a table. the
maximum allowed to create primary keys for columns is 16,
but we call it primary key for one column only and the
remaining we call it as composite primary key..

create table TestPrimaryKey(ID int,Name nvarchar(50),Email
nvarchar(50),Phone nvarchar(12),cellphone nvarchar
(10),primary key(ID,Name,Email,Phone,cellphone))

the above table creates primary key for all above mentioned
columns.

Is This Answer Correct ?    1 Yes 1 No

Can a table have two primary keys?..

Answer / antonis flangofas

ofc you can, stop giving to ppl wrong answers here it is

CREATE TABLE track(
album CHAR(10),
disk INTEGER,
posn INTEGER,
song VARCHAR(255),
PRIMARY KEY (album, disk, posn)
)

if you want to avoid to have id you use this way.

Is This Answer Correct ?    1 Yes 1 No

Can a table have two primary keys?..

Answer / dan

Kumar Navdeep Shanker

I have created the table provided and it works well.
You said that is possible to have two primary key, I am
sorry I have to disagree with you and all who said yes.

Let me explain using your table

cno balance cname
1 2 w
2 2 x
1 3 r
primary key no two tuple have the same value

what you are providing is a composite key

Thus, we can have more than one key in a table that the
compinaition of the keys are unique

BUT we have only one primary key that means it is unique

Please correct me if i am wrong

Is This Answer Correct ?    0 Yes 0 No

Can a table have two primary keys?..

Answer / san

Yes we can keep but it become composite key
means primary key for that perticular coloum only

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

Can we have two clustered index on a table?

0 Answers  


what is the output of this query selet * from employee where 1=2 ??

11 Answers  


What is Data Concarency and Consistency?

1 Answers  


What is difference between function and trigger?

0 Answers  


What is the most common sql injection tool?

0 Answers  


How can you select unique records from a table?

0 Answers  


what is the difference between varray and table data type..please expalain with some examples... under what situation you will go for varray..instead of index by table...

1 Answers   HCL, Satyam,


How do you identify a primary key?

0 Answers  


what is table? : Sql dba

0 Answers  


how to check the 3rd max salary from an employee table? One of the queries used is as follows: select sal from emp a where 3=(select count(distinct(sal)) from emp b where a.sal<=b.sal). Here in the sub query "select count(distinct(sal)) from emp b where a.sal<=b.sal" or "select count(distinct(sal)) from emp b where a.sal=b.sal" should reveal the same number of rows is in't it? Can any one here please explain me how is this query working perfectly. However, there is another query to get the 3rd highest of salaries of employees that logic I can understand. Pls find the query below. "select min(salary) from emp where salary in(select distinct top 3 salary from emp order by salary desc)" Please explain me how "select sal from emp a where 3=(select count(distinct(sal)) from emp b where a.sal<=b.sal)" works source:http://www.allinterview.com/showanswers/33264.html. Thanks in advance Regards, Karthik.

4 Answers  


What are the two types of periodical indexes?

0 Answers  


what is the difference between a web-garden and a web-farm? : Sql dba

0 Answers  


Categories