Questions tagged [compound-key]

Questions regarding usage of compound key (specific composite key) in database

76 questions
1
vote
0 answers

'Create a Campaign Conversion' linkedin API giving 'is not a Compound key' error with status 400

I am new to using linkedin APIs and all I am trying to do is use this API to create a campaign conversion, by making a PUT request through this…
1
vote
1 answer

Can I avoid redundant primary key columns in a MySQL table for django (python)?

I am aware of the fact, the if I use the ORM of Django every table has to have a primary key column. Somehow if you have a many_to_many table which links to tables (let's call them authors and books) you would get something like: id author_id …
Aufwind
  • 25,310
  • 38
  • 109
  • 154
1
vote
3 answers

Mysql key: is single key guaranteed to be faster than compound key?

In the following two scenarios: create table `Table` ( `id` int(10), `column1` int(10), `column2` int(10), KEY (`column2`) ); and create table `Table` ( `id` int(10), `column1` int(10), `column2` int(10), KEY…
cr001
  • 655
  • 4
  • 16
1
vote
0 answers

Microsoft Access - Using Concat related on a field with a compound key

I am working on trying to use Allen Browns ConcatRelated() method (http://allenbrowne.com/func-concat.html) on a table in the following format: [id1 | id2 | id3 | id4 | id5 | otherfield | year] where id1 to id5 are the fields I need matching to…
amisos
  • 13
  • 3
1
vote
1 answer

How to set cascade on SQLite database with compound primary foreign key?

I have a db that's structured with a supertype table as well as subtype tables like so: EVENT PatientId INTEGER, DateTime TEXT, EventTypeCode TEXT, PRIMARY KEY( PatientId, DateTime, EventTypeCode ) different types of events have their own tables…
Damon
  • 10,493
  • 16
  • 86
  • 144
1
vote
2 answers

Why is this compound primary key not working as expected?

I have a table "tbl_project_user_assignment" with a compound primary key. It is made up of project_id and user_id Each of these are also a foreign key to the project and user tables respectively. At the moment, I have 2 entries in this table as…
Tom
  • 13
  • 2
1
vote
0 answers

Realm compound key workaround by using complex object as primary key

I m thinking about a workaround for realms inability to check for duplicate compound keys on entities (no compound keys supported): what about declaring a compound key class - and then declaring a primary key of that compound key class as field of…
1
vote
0 answers

MySQL: INSERT and auto increment based on condition

I am using InnoDB. My table structure is as follows: CREATE TABLE `generic_part_name` ( `ID` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `ID_Lang` tinyint(3) unsigned NOT NULL, `Name` varchar(250) NOT NULL, PRIMARY KEY (`ID`,`ID_Lang`), …
pankal
  • 124
  • 13
1
vote
3 answers

compound-key as lookup function in clojure

In clojure you can use both maps and keys as look up functions hence ({:a 1 :b 2} :a) and (:a {:a 1 :b 2}) are both viable lookup functions. Why then can you use a map as a lookup function for a compound-key but not the other way around? This…
Kevin Behan
  • 486
  • 5
  • 20
1
vote
1 answer

Numpy arrays with compound keys; find subset in both

I have two 2D numpy arrays shaped: (19133L, 12L) (248L, 6L) In each case, the first 3 fields form an identifier. I want to reduce the larger matrix so that it only contains rows with identifiers that also exist in the second matrix. So the shape…
user2290362
  • 717
  • 2
  • 7
  • 21
1
vote
1 answer

SQL Server : database design - composite primary key

I need your suggestion on how to implement SQL Server table relationships. I have many customers, each holds a unique id (customerID) each customer can have many categories associated (categoryID) each customer can have many sub categories…
1
vote
1 answer

Aggregate hourly means based on compound field expression

I am trying to calculate the hourly mean of x in a data frame similar to this: min hour day month year x 1 10 22 31 12 2013 18.3 2 30 22 31 12 2013 16.5 3 50 22 31 12 2013 15.7 4 10 23 31 12 2013 16.7 5 30 23 31 …
Christoffer
  • 643
  • 1
  • 6
  • 22
1
vote
1 answer

JPA - Compound key vs generated id in Many to many table

I am creating a kind of social network and I have users that can follow other users. So I have an entity like: @Entity public class FollowedUser{ @ManyToOne private User user; @ManyToOne private User followedUser; //more…
Aliuk
  • 1,249
  • 2
  • 17
  • 32
1
vote
1 answer

ORM support for compound primary keys

I've read that compound primary keys will confuse the hell out of typical ORM code generators. Which ORMs work best with compound PKs and which to avoid? (I've a particular interest in .NET)
onedaywhen
  • 55,269
  • 12
  • 100
  • 138
1
vote
1 answer

Primary key column does not allow null values

I have a question concerning primary key or compound key. I have created a table where there are only two attributes and both are are primary keys. The primary keys name are item_ID̀ andSName` These two are foreign keys to another primary key (to…
PuchuKing33
  • 381
  • 3
  • 7
  • 19