Can I define two primary keys in a database table & why?ExactTarget - How to post a record to a data extension that has no primary key?Can you use two DE within the same AmpscriptingHow do you construct a REST API URI with multiple primary keys?Upserting Duplicates despite three part primary keyshow to append one data extension data to other sendable data extension?Trying to combine two DE and getting violation of primary key errorViolation of PRIMARY KEY constraint. Cannot insert duplicate keyData Extension synchronous Rest API where there are only primary keysImporting data with primary key duplicatesMarketing Cloud - Adding additional Primary Keys to a Existing Data Extension
Policemen catch thieves
Change the boot order with no option in UEFI settings
Impossible darts scores
Change CPU MHz from Registry
What is the legal status of travelling with (unprescribed) methadone in your carry-on?
How to split an equation over two lines?
Hot coffee brewing solutions for deep woods camping
Could Sauron have read Tom Bombadil's mind if Tom had held the Palantir?
Fedora boot screen shows both Fedora logo and Lenovo logo. Why and How?
Analog is Obtuse!
Do hotel cleaning personnel have any benefit from leaving empty bottles in the room as opposed to returning them to the store?
Can the negators "jamais, rien, personne, plus, ni, aucun" be used in a single sentence?
Is this one of the engines from the 9/11 aircraft?
Why do some games show lights shine through walls?
Is adding a new player (or players) a DM decision, or a group decision?
Abel-Jacobi map on symmetric product of genus 4 curve
Are there any vegetarian astronauts?
What reason would an alien civilization have for building a Dyson Sphere (or Swarm) if cheap Nuclear fusion is available?
Why is the voltage measurement of this circuit different when the switch is on?
Can White Castle?
How can I repair scratches on a painted French door?
Peace Arch without exiting USA
Plotting with different color for a single curve
Why does the numerical solution of an ODE move away from an unstable equilibrium?
Can I define two primary keys in a database table & why?
ExactTarget - How to post a record to a data extension that has no primary key?Can you use two DE within the same AmpscriptingHow do you construct a REST API URI with multiple primary keys?Upserting Duplicates despite three part primary keyshow to append one data extension data to other sendable data extension?Trying to combine two DE and getting violation of primary key errorViolation of PRIMARY KEY constraint. Cannot insert duplicate keyData Extension synchronous Rest API where there are only primary keysImporting data with primary key duplicatesMarketing Cloud - Adding additional Primary Keys to a Existing Data Extension
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
In relational databases we can only define one primary key. Is it possible to define two primary keys, probably one is primary and other is secondary key and can be joined on any of the two fields.
marketing-cloud query sql contactbuilder
add a comment |
In relational databases we can only define one primary key. Is it possible to define two primary keys, probably one is primary and other is secondary key and can be joined on any of the two fields.
marketing-cloud query sql contactbuilder
Is this question related to Salesforce Marketing Cloud?
– David Reed♦
Jun 15 at 11:46
yes. This is related to contact builder in marketing cloud. sql is used to create data extensions.
– ASHISH
Jun 15 at 12:16
I've added those relevant tags to the question. Generic relational database questions sometimes are closed as off-topic; it's helpful to make the context clear.
– David Reed♦
Jun 15 at 12:30
add a comment |
In relational databases we can only define one primary key. Is it possible to define two primary keys, probably one is primary and other is secondary key and can be joined on any of the two fields.
marketing-cloud query sql contactbuilder
In relational databases we can only define one primary key. Is it possible to define two primary keys, probably one is primary and other is secondary key and can be joined on any of the two fields.
marketing-cloud query sql contactbuilder
marketing-cloud query sql contactbuilder
edited Jun 15 at 12:19
David Reed♦
45.5k8 gold badges26 silver badges65 bronze badges
45.5k8 gold badges26 silver badges65 bronze badges
asked Jun 15 at 8:02
ASHISHASHISH
31113 bronze badges
31113 bronze badges
Is this question related to Salesforce Marketing Cloud?
– David Reed♦
Jun 15 at 11:46
yes. This is related to contact builder in marketing cloud. sql is used to create data extensions.
– ASHISH
Jun 15 at 12:16
I've added those relevant tags to the question. Generic relational database questions sometimes are closed as off-topic; it's helpful to make the context clear.
– David Reed♦
Jun 15 at 12:30
add a comment |
Is this question related to Salesforce Marketing Cloud?
– David Reed♦
Jun 15 at 11:46
yes. This is related to contact builder in marketing cloud. sql is used to create data extensions.
– ASHISH
Jun 15 at 12:16
I've added those relevant tags to the question. Generic relational database questions sometimes are closed as off-topic; it's helpful to make the context clear.
– David Reed♦
Jun 15 at 12:30
Is this question related to Salesforce Marketing Cloud?
– David Reed♦
Jun 15 at 11:46
Is this question related to Salesforce Marketing Cloud?
– David Reed♦
Jun 15 at 11:46
yes. This is related to contact builder in marketing cloud. sql is used to create data extensions.
– ASHISH
Jun 15 at 12:16
yes. This is related to contact builder in marketing cloud. sql is used to create data extensions.
– ASHISH
Jun 15 at 12:16
I've added those relevant tags to the question. Generic relational database questions sometimes are closed as off-topic; it's helpful to make the context clear.
– David Reed♦
Jun 15 at 12:30
I've added those relevant tags to the question. Generic relational database questions sometimes are closed as off-topic; it's helpful to make the context clear.
– David Reed♦
Jun 15 at 12:30
add a comment |
2 Answers
2
active
oldest
votes
Yes , we can only define one primary key but you can define unique indexes in your table which can also work like primary key in that case they should have unique values .
New contributor
2
SFMC Users cannot create indexes on Data Extensions without some sort of engagement with Salesforce.
– Adam Spriggs
Jun 16 at 11:38
This answer seems misleading to me. You can define multiple primary keys that act as a single composite key, so saying you can only define a single primary key but can include unique indexes doesn't seem entirely accurate.
– Jason Hanshaw
Jun 17 at 2:28
add a comment |
Could you tell a bit more about your goal? That might help to give you the best answer. More than one road leads to Rome after all. :-)
You could have unique indexes
set up by Salesforce, but these may require Salesforce Services (at a fee), although you can also try to initiate a support ticket. I'm not sure if they would handle that now.
Another - perhaps easier - work around is to work with two data extensions:
- DE1: Primary key + any other information
- DE2: Primary key (as a look up to DE1) + your "secondary key"
Then you could write a (SQL) Query Activity. Something like:
SELECT
field1
field2
...
FROM DE1
INNER JOIN DE2
DE1.PrimaryKey on DE2.PrimaryKey
Or use a third party tool like DESelect if you don't like writing SQL.
Let me know if this helps! :-)
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f266091%2fcan-i-define-two-primary-keys-in-a-database-table-why%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Yes , we can only define one primary key but you can define unique indexes in your table which can also work like primary key in that case they should have unique values .
New contributor
2
SFMC Users cannot create indexes on Data Extensions without some sort of engagement with Salesforce.
– Adam Spriggs
Jun 16 at 11:38
This answer seems misleading to me. You can define multiple primary keys that act as a single composite key, so saying you can only define a single primary key but can include unique indexes doesn't seem entirely accurate.
– Jason Hanshaw
Jun 17 at 2:28
add a comment |
Yes , we can only define one primary key but you can define unique indexes in your table which can also work like primary key in that case they should have unique values .
New contributor
2
SFMC Users cannot create indexes on Data Extensions without some sort of engagement with Salesforce.
– Adam Spriggs
Jun 16 at 11:38
This answer seems misleading to me. You can define multiple primary keys that act as a single composite key, so saying you can only define a single primary key but can include unique indexes doesn't seem entirely accurate.
– Jason Hanshaw
Jun 17 at 2:28
add a comment |
Yes , we can only define one primary key but you can define unique indexes in your table which can also work like primary key in that case they should have unique values .
New contributor
Yes , we can only define one primary key but you can define unique indexes in your table which can also work like primary key in that case they should have unique values .
New contributor
New contributor
answered Jun 15 at 8:16
diamonddiamond
621 bronze badge
621 bronze badge
New contributor
New contributor
2
SFMC Users cannot create indexes on Data Extensions without some sort of engagement with Salesforce.
– Adam Spriggs
Jun 16 at 11:38
This answer seems misleading to me. You can define multiple primary keys that act as a single composite key, so saying you can only define a single primary key but can include unique indexes doesn't seem entirely accurate.
– Jason Hanshaw
Jun 17 at 2:28
add a comment |
2
SFMC Users cannot create indexes on Data Extensions without some sort of engagement with Salesforce.
– Adam Spriggs
Jun 16 at 11:38
This answer seems misleading to me. You can define multiple primary keys that act as a single composite key, so saying you can only define a single primary key but can include unique indexes doesn't seem entirely accurate.
– Jason Hanshaw
Jun 17 at 2:28
2
2
SFMC Users cannot create indexes on Data Extensions without some sort of engagement with Salesforce.
– Adam Spriggs
Jun 16 at 11:38
SFMC Users cannot create indexes on Data Extensions without some sort of engagement with Salesforce.
– Adam Spriggs
Jun 16 at 11:38
This answer seems misleading to me. You can define multiple primary keys that act as a single composite key, so saying you can only define a single primary key but can include unique indexes doesn't seem entirely accurate.
– Jason Hanshaw
Jun 17 at 2:28
This answer seems misleading to me. You can define multiple primary keys that act as a single composite key, so saying you can only define a single primary key but can include unique indexes doesn't seem entirely accurate.
– Jason Hanshaw
Jun 17 at 2:28
add a comment |
Could you tell a bit more about your goal? That might help to give you the best answer. More than one road leads to Rome after all. :-)
You could have unique indexes
set up by Salesforce, but these may require Salesforce Services (at a fee), although you can also try to initiate a support ticket. I'm not sure if they would handle that now.
Another - perhaps easier - work around is to work with two data extensions:
- DE1: Primary key + any other information
- DE2: Primary key (as a look up to DE1) + your "secondary key"
Then you could write a (SQL) Query Activity. Something like:
SELECT
field1
field2
...
FROM DE1
INNER JOIN DE2
DE1.PrimaryKey on DE2.PrimaryKey
Or use a third party tool like DESelect if you don't like writing SQL.
Let me know if this helps! :-)
add a comment |
Could you tell a bit more about your goal? That might help to give you the best answer. More than one road leads to Rome after all. :-)
You could have unique indexes
set up by Salesforce, but these may require Salesforce Services (at a fee), although you can also try to initiate a support ticket. I'm not sure if they would handle that now.
Another - perhaps easier - work around is to work with two data extensions:
- DE1: Primary key + any other information
- DE2: Primary key (as a look up to DE1) + your "secondary key"
Then you could write a (SQL) Query Activity. Something like:
SELECT
field1
field2
...
FROM DE1
INNER JOIN DE2
DE1.PrimaryKey on DE2.PrimaryKey
Or use a third party tool like DESelect if you don't like writing SQL.
Let me know if this helps! :-)
add a comment |
Could you tell a bit more about your goal? That might help to give you the best answer. More than one road leads to Rome after all. :-)
You could have unique indexes
set up by Salesforce, but these may require Salesforce Services (at a fee), although you can also try to initiate a support ticket. I'm not sure if they would handle that now.
Another - perhaps easier - work around is to work with two data extensions:
- DE1: Primary key + any other information
- DE2: Primary key (as a look up to DE1) + your "secondary key"
Then you could write a (SQL) Query Activity. Something like:
SELECT
field1
field2
...
FROM DE1
INNER JOIN DE2
DE1.PrimaryKey on DE2.PrimaryKey
Or use a third party tool like DESelect if you don't like writing SQL.
Let me know if this helps! :-)
Could you tell a bit more about your goal? That might help to give you the best answer. More than one road leads to Rome after all. :-)
You could have unique indexes
set up by Salesforce, but these may require Salesforce Services (at a fee), although you can also try to initiate a support ticket. I'm not sure if they would handle that now.
Another - perhaps easier - work around is to work with two data extensions:
- DE1: Primary key + any other information
- DE2: Primary key (as a look up to DE1) + your "secondary key"
Then you could write a (SQL) Query Activity. Something like:
SELECT
field1
field2
...
FROM DE1
INNER JOIN DE2
DE1.PrimaryKey on DE2.PrimaryKey
Or use a third party tool like DESelect if you don't like writing SQL.
Let me know if this helps! :-)
answered Jun 16 at 14:44
alamoalamo
1166 bronze badges
1166 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Salesforce Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f266091%2fcan-i-define-two-primary-keys-in-a-database-table-why%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Is this question related to Salesforce Marketing Cloud?
– David Reed♦
Jun 15 at 11:46
yes. This is related to contact builder in marketing cloud. sql is used to create data extensions.
– ASHISH
Jun 15 at 12:16
I've added those relevant tags to the question. Generic relational database questions sometimes are closed as off-topic; it's helpful to make the context clear.
– David Reed♦
Jun 15 at 12:30