Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
One of my table having combintaion of primary key, both i did index for that table.

EX: TableName -> StudentMark

Primay Key -> ClassName, RollNo (Both are i set index)


Now i am doing the query

Update StudentMark set name ='XXX' where ClassName ="X" and RollNo = 1

Update StudentMark set name ='XXX' where RollNo = 1 and ClassName ="X"

which query is proper. because i did the index classname, rollno.
Posted

1 solution

Your table structure is wrong. Table should have only 1 Primary Key with datatype Number/Numeric.
If other Columns you want to have different values then give constraint a "Unique".

Plz know basic concept of Primary Key & Unique Key before implementing.
Primary Key is having indexes by default.

Thanking you meanwhile, Vardhan Desai.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900