Questions tagged [primary-key]
In relational database design, a primary key can uniquely identify each row in a table. A primary key comprises a single column or a set of columns.
688 questions
1 vote
1 answer
105 views
Null value does not violate FOREIGN KEY constraint?
I am wondering why Postgres allows to insert a non-existing values for a foreign key to a nullable multicolumn unique constraint. (Cannot be an actual primary key.) I made a fiddle. I expected this to ...
2 votes
1 answer
327 views
Change Tracking and Primary keys
I have a SQL Server database with Change Tracking enabled on a hand full of tables and it's used by another application on the cloud to sync data between both databases. When an existing customer ...
1 vote
0 answers
63 views
Foreign key does not appear in table structure in PHPMYADMIN
I am creating two tables called customer and item. For the customer table customerID is the primary key and for the item table itemID is the primary key. And I am creating another table which is ...
0 votes
1 answer
61 views
I should let the user type the primary key?
I have a Products table, 2 options: Let the user type the PK because some users can input Barcodes or no (in this case, the app will let to user free to input anything for example his own code ...
0 votes
1 answer
44 views
How to design properly a membership history accross multiple groups?
I'm looking to design an application (Python with sqlite) which deals with some contributors moving across several groups through time. My design looks currently like (PK in bold weight, FK in italic, ...
0 votes
5 answers
201 views
Log table without primary key
I have a SQL Server log table that includes a column "Id" This is an identity column, but not a primary key, it is not even indexed. This would have just been set up from some tutorial for ...
0 votes
0 answers
108 views
Is it a good idea to use time as primary key component?
I have a log/audit table which the only index I will ever use is time window. Is it a good idea to PRIMARY KEY it as: CREATE TABLE events ( created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW(...