Skip to main content

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.

1 vote
1 answer
107 views

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 ...
Emaborsa's user avatar
  • 121
3 votes
2 answers
169 views

I'm building out a data warehouse system in PostgreSQL that will be replicated across several machines. Each machine will read and write to its respective database, independent of the other machines ...
Yamen Alghrer's user avatar
2 votes
1 answer
333 views

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 ...
MindDData's user avatar
  • 123
1 vote
1 answer
81 views

For two Oracle database tables in the same schema, is it possible to keep their primary keys totally separate, so that an integer representing a primary key would appear in at most one of these tables?...
JosephDoggie's user avatar
1 vote
0 answers
64 views

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 ...
Charith Wirul's user avatar
0 votes
0 answers
60 views

This is my table: CREATE TABLE IF NOT EXISTS public.ob_samples_sc5555 ( stamp timestamp(6) with time zone NOT NULL, oblvl smallint NOT NULL, olots integer NOT NULL, CONSTRAINT ...
Leon's user avatar
  • 413
0 votes
1 answer
62 views

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 ...
Lund's user avatar
  • 3
4 votes
1 answer
268 views

In AdventureWorks2016 when I execute the following query: USE AdventureWorks2016 BEGIN TRAN; SELECT Sales.SalesOrderHeader.SalesOrderID FROM Sales.SalesOrderHeader JOIN Sales.Customer ...
Suleyman Essa's user avatar
0 votes
1 answer
44 views

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, ...
Amessihel's user avatar
  • 103
0 votes
1 answer
108 views

I have few questions related to primary key in a table I have a table with id as identity column and it is set as primary key and also it created as clustured index by default I want to remove the ...
user avatar
0 votes
5 answers
204 views

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 ...
F Dev's user avatar
  • 1
3 votes
2 answers
581 views

Suppose that I have a table with many columns that I don't care about, but two that I do: Primary and Secondary. There is a clustered primary key on Primary. CREATE TABLE [dbo].[...
J. Mini's user avatar
  • 1,362
0 votes
0 answers
109 views

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(...
gcb's user avatar
  • 101
1 vote
1 answer
439 views

I'm struggling to attach a partition to a table with a primary key. I have a partitioned table Transactions: create table "Transactions" ( id bigserial ...
Philipp Faster's user avatar

15 30 50 per page
1
2 3 4 5
50