Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
2k views

How can I use composite primary keys in django?

I want to use composite primary keys in django but I can't find a solution, I tried it in different ways, even trying to make an alter in the table but it won't let me, I want to use it based on this ...
Hey Mr Dave - HMD's user avatar
1 vote
1 answer
252 views

Django mySQL database insert query using .save() and .validate_unique with a composite primary key

I am trying to insert directly into a mySQL database table that has a composite primary key value consisting of 'Fname', 'Lname' and 'DOB'. I want to allow the user to be able to add to the database ...
Floris Kruger's user avatar
0 votes
1 answer
465 views

OLAP Data Warehouse - composite primary key as multiple or single fields

I'm building a data warehouse, and the data is of a quality where 8 fields may be required to uniquely identify a record, and this applies to three tables, each of which will have a few million rows ...
Phil T's user avatar
  • 87
0 votes
1 answer
1k views

How best to update row where composite primary key values change

We have numerous tables where we have composite keys with MULTIPLE entries. In some cases as many as SIX values that make up the primary key for a table that is not super large, maybe a few thousand ...
Terry H's user avatar
  • 350
-1 votes
1 answer
88 views

Auto incrementing composite key

I have a relatively simple need -- I have a table with a composite primary key that includes an integer index to be autoincremented. However, I cannot figure out how to do this. I have read the ...
zagaroo's user avatar
  • 21
0 votes
2 answers
1k views

How to efficiently store tags for items in relational database?

Generally speaking, is making all attributes in an entity a concat PK possible, or is it a bad practice? A product may have many tags and how do I store these tags for each product? Is it possible to ...
jfvii's user avatar
  • 1
0 votes
0 answers
114 views

Database; 2NF to 3NF questions about (Primary) Keys

I'm currently learning about databases and 1NF, 2NF and 3NF. So far 1NF is easy, but I get confused going to 2NF and 3NF regaring Primary Keys and foreign keys. I've read a lot of posts on here but I ...
Xavvey's user avatar
  • 43
0 votes
0 answers
929 views

MySQL composite primary key and foreign keys at the same time

I'm trying to create a web application about cooking, and I get weird behaviours when creating my MySQL database. I have the following tables: friends and user, described as below CREATE TABLE IF NOT ...
cdaveau's user avatar
  • 129
0 votes
1 answer
1k views

Can weak entity has more than one primary key if it has more than one strong entity?

If I have a weak entity with no attributes and has a four weak relationship with the owner entities and I want to design the relational schema for this weak entity, Can I take all primary keys of the ...
user avatar
0 votes
1 answer
501 views

Create foreign key that references to composite key

CREATE TABLE Person ( PersonID int NOT NULL IDENTITY, PersonName nvarchar(30) NOT NULL, PersonSurname nvarchar(30) NOT NULL, PRIMARY KEY (PersonID) ) CREATE TABLE Author ( ...
Baris's user avatar
  • 29
2 votes
1 answer
187 views

Why Composite Primary Key is not added as a Foreign Key in psql (rails app)?

I am using activerecord-multi-tenant gem for implementing MultiTenancy in my rails project. Followed instruction from here I have a User model, Attendance Model which belongs to User, And Company as a ...
Maliha Rahman's user avatar
0 votes
1 answer
436 views

Can I create a composite key with an extra character?

I'm building a new DB using MySQL to store lessons learned across a variety of projects. When we talk about this in the office, we refer to lessons by the Project Number and Lesson Number, i.e. PR12-...
Haggishunt56's user avatar
1 vote
2 answers
96 views

When will it be considered an OVERKILL when making a composite primary key?

Recently, I stumbled upon this question when looking through my database notes. In the case of an annual examination (A Levels, O Levels) where students who did not attain their desired marks are ...
Yong2Quan's user avatar
1 vote
1 answer
1k views

How can I relate a primary key field to multiple tables?

I have 4 tables: User Reports Photos Locations I am allowed to report photos, users, and locations. The primary key of my Reports table is (User_Id, Reported_Id) Reported_Id could belong to any ...
Mixture's user avatar
  • 35
1 vote
2 answers
99 views

Handling compound primary keys in NHibernate event listeners

I'm trying to extract the primary key property name and value of the original entity from within an NHibernate event listener and I want it to be able to handle compound primary keys. The problem I'm ...
Simon Morgan's user avatar
  • 2,268

15 30 50 per page
1
2 3 4 5 6