Questions tagged [primary-key]

A key is a set of attributes that is irreducibly unique and non-nullable within a table.

Filter by
Sorted by
Tagged with
0 votes
1 answer
32 views

Harmonizing data spread over multiple rows with duplicate values for some keys

I face data spread over multiple columns. Some rows hold duplicate data for a key. Some semantically similar data Others new fresh data (sometimes only for different keys - however sometimes also for ...
Georg Heiler's user avatar
-1 votes
0 answers
21 views

.Net EF Migration error: List<Enum> requires a primary key to be defined

I'm defining some entities for my application and I've come across the following error when trying to create a migration: The entity type 'List' requires a primary key to be defined. If you intended ...
Ovidiu's user avatar
  • 1
0 votes
1 answer
33 views

Error in MySQL when trying to make foreign key refer to primary key

I am trying to make a foreign key in the table songs refer to the primary key in the table artists, but I get Error Code: 3780. Referencing column 'song_name' and referenced column 'artist_id' in ...
lakritssnöre's user avatar
-1 votes
1 answer
116 views

During saving the primary key on the invoice how do I also save the primary key on the foreign key of invoice details?

I have a table for invoices with primary key id and for invoice details with foreign key invoice_id. During saving the primary key on the invoice how do I also save the primary key on the foreign key ...
babe_engineer's user avatar
0 votes
0 answers
11 views

_mysql_connector.MySQLInterfaceError: Duplicate key name 'locationid_index'

Referring the two foreign keys with same primary key in different table causes error in accessing # Create the 'rides' table if it doesn't exist cursor.execute(''' CREATE TABLE IF NOT ...
Santhosh Uppuluri's user avatar
-1 votes
2 answers
66 views

Is an autoincrement key always guaranteed to increase in T-SQL?

I am using an AUTOINCREMENT PRIMARY KEY in-luau of a timestamp for ordering purposes in a GROUP BY clause. This is a minimal example to illustrate only: CREATE TABLE Items( ItemId BIGINT ...
sashoalm's user avatar
  • 75.9k
0 votes
2 answers
59 views

Django model with uuid5 primary key

I have a problem to define Django model where the Primary Key is UUID5 that base on model fields. Here is what I have got already. class Place(models.Model): uuid = models.UUIDField(primary_key=...
ORP's user avatar
  • 3
0 votes
2 answers
39 views

Altering Oracle Primary Keys [closed]

Oracle table may have one or more columns designated as the primary key. This designation occurs at the time that the table is created. Assume the table has multiple columns as part of it's primary ...
Eshe's user avatar
  • 11
0 votes
2 answers
49 views

Re-Insert/Update primary key value after a mistake (restoration) [duplicate]

I encounter a problem in SQL Server. We have a table Country with N_Country as its primary key. Please note the table have like 10 columns but I am only showing these two for the example: N_Country ...
Maxime's user avatar
  • 15
0 votes
1 answer
58 views

Relations between entities in ER diagram: can they have a key?

Can a relation between entities have a key in an ER diagram? Doing my assignment I added a primary key to a relation between two entities but the instructor didn't agree.
Judy's user avatar
  • 11
1 vote
1 answer
56 views

EF core Exceptions not getting Caught in ExceptionFilters

Almost all exceptions are getting caught except the exception from EF core . The exception filter is catching any error . but not errors from entity framework. If you need any other info like efcore ...
saronyo bose's user avatar
-1 votes
1 answer
75 views

Does using the UUID-PostgreSql data type solve performance issues? [closed]

I've read a lot of different opinions on the subject of "uuid as primary keys" and I'm a bit confused. In particular, this article makes me unsure what's the best way: https://tomharrisonjr....
wuarmin's user avatar
  • 3,459
2 votes
1 answer
84 views

adding a column from one dataframe to another according to shared values

In python, I want to add a column from dataframe A to dataframe B. But the rows should be match with the primary key. I tried dataframeinsert() and .add but they are not doing it with regarding to ...
murat can Urhan's user avatar
0 votes
1 answer
57 views

Making (3) composite primary key less redundant

I have a table with a composite key (3) like this: sub_product - product_id (PK FK) - product_type (PK FK) - size_id (PK FK) - quantity quantity is dependent on all 3 keys. Is reducing this to ...
StackerCen's user avatar
0 votes
1 answer
71 views

What is the correct way to use a foreign key as a primary key in Entity Framework?

Here's the id generating entity: public class ConceptDataEntry { [Key] public long Id { get; set; } } Here's an example entity reliant on generated ids of the ConceptDataEntry entity: public ...
hamstar's user avatar
  • 141
0 votes
1 answer
40 views

How to change table primary key with existing data from character to serial

I am working with a colleague who is new to Postgres and databases in general. She created a table with a column ID of character varying type and made that the primary key. So apparently, when running ...
Steve's user avatar
  • 953
0 votes
0 answers
15 views

How do i connect relationships of tables on power BI manually

ERD relations, connecting 5 tables i tried doing it automatically and it works but i want to do it manually, I WANT TO SEE IF I CAN ADD RELATIONSHIPS in relation with the foreign keys and primary keys ...
Peace Dagada's user avatar
-1 votes
1 answer
42 views

Add primary key to existing sql table [duplicate]

In a table with columns ID, Name and Qualifications I am trying to make ID my primary key, but I get an error. import sqlite3 as SQLite try: objConexionSQLite = SQLite.connect('...
Eric Sebastián Sánchez Conde's user avatar
0 votes
0 answers
46 views

Primary Key and Default Constraint Lost after Apply Always Encrypt

I already successfully setup always encrypt with secure enclave in SQL Server 2022 (with no attestation). Then I create table with this code. CREATE TABLE dbo.tbTesting ( idData INT PRIMARY KEY, ...
Liudi Wijaya's user avatar
0 votes
0 answers
26 views

My Primary key constraint is mixed up. Pointing to a column in another table

I discovered this when I in IBConsole clicked on the table name and then on the data tab. No data was displayed. I then tried to do the same with IBExpert. In this case an error message was displayed: ...
Mikael's user avatar
  • 1
-2 votes
1 answer
52 views

SQL copy and paste table data into that same table by only changing one value

I want to copy and paste table data into that same table by only changing one value Example: BillingLocationID It's not possible to do it one by one inserting there are large number of rows. I've ...
Chrishan Kankanamge's user avatar
0 votes
1 answer
53 views

Changing data type to column that is part of clustered primary key

I need to change data type of column which is part of clustered key I saw in posts that the best way is to create a new column with desired type, move data there from original column, and then drop ...
FSDev's user avatar
  • 1
0 votes
0 answers
72 views

Customize the primary key name with Liquibase and Hibernate for liquibase:diff

I have a Spring Boot application where I am trying to automatically generate a liquibase diff .sql (using mvn liquibase:diff) with my own NamingStrategy. I created a custom ImplicitNamingStrategy and ...
FML's user avatar
  • 1
-2 votes
2 answers
57 views

INSERT from one table to another but assign new PRIMARY KEYs

I have two MySQL tables. One is a large list of entries which is basically the main table. The second is a table of pending entries. Pending entries will either be merged into the large list of ...
azoundria's user avatar
  • 956
0 votes
0 answers
63 views

Postgresql primary key violation duplicate key value

Can some body tell me please why I am getting Unique violation: 7 ERROR: duplicate key value violates unique constraint if I try to make simple insert to the Postgresql table? I made some insert ...
Čamo's user avatar
  • 3,870
0 votes
1 answer
73 views

Add Primary Key constraint to partitions of a table in Postgres 13

I'm new to PostgreSQL and I need to convert an existing non-partitioned table to a partitioned table. Since you can't alter an existing table to be partitioned, I created a new partitioned table. ...
Dhanushka Ekanayake's user avatar
0 votes
1 answer
30 views

How trigger will work if using one table primary key to other table foreign key

I have two DB. One is remote DB and other is local DB. Both have three tables. I have created a trigger for orders table which will update/delete when there is any changes in remote db. I need to ...
Arulselvam's user avatar
-2 votes
1 answer
79 views

Left join on primary key without selecting fields and Oracle execution plan

I need an explanation and an advice on the execution plan in Oracle. I have 3 tables in my Oracle database: t (id, name, t1_id, t2_id) t1 (id, name) t2 (id, name) id is a primary key in each table. ...
Room'on's user avatar
  • 101
-1 votes
1 answer
82 views

How to take last inserted record in oracle table

I have a table called orderdetails. In that I have column named ID which is primary key. I want to take the recently added record in that table. I used to filter out the last value inserted in desc ...
Srinivasan Sekar's user avatar
-1 votes
2 answers
123 views

Create table with multiple Foreign Keys

When I try to create a table with 1 PK & 3 FK. But faced the below error. Code 1: SQL: CREATE TABLE Rent ( cardID number, itemID varchar2(10), appropriationDate DATE, returndate ...
Nanda's user avatar
  • 11
0 votes
0 answers
20 views

Caused by: org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property

I'm trying to insert values to JVCommitProperty Table but getting the "Caused by: org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property [com.dev.neo....
PersonuNique's user avatar
0 votes
0 answers
23 views

API: _pk (Primary key) Integration in python

I am trying to integrate an API with Python. The final result I am looking for is to obtain a list of revisions depending on what schematization is clicked (which is specified in another parameter). ...
user22363566's user avatar
-2 votes
1 answer
64 views

How do I join two tables in R when the key column names don't match?

I have a main_table that has a column called category, then I have a category_table with an id column. They function like primary and foreign keys, but when I try and join the tables, the ID's don't ...
siekertr21's user avatar
-1 votes
1 answer
49 views

Need a user friendly UniqueId string for DB records [closed]

I need a user friendly UniqueId for each appointment item in my application. This UniqueId is a "folder" name for BLOBs attached to the item. So a Guid is not good. One solution I came up ...
David Thielen's user avatar
-2 votes
1 answer
83 views

Auto Increment not working automatically in child Table Room Database

Auto increment in child Table in Room not auto incrementing menuID is set from api whereas sectionID and itemID should be auto incremented. Now everything working fine but I need to know why I need ...
Taimoor Khan's user avatar
0 votes
1 answer
47 views

How do I get rid of phantom primary key in MariaDB that cannot be dropped?

There is a primary key that I cannot drop, and a unique key that I cannot see. I am using MariaDB 11.0.2. Describe Table MariaDB [My_Data_Base]> describe Languages; +-----------+----------+------+--...
Centaro's user avatar
  • 25
0 votes
1 answer
14 views

DolphinDB: How to access data from the same source but stored in different databases?

I have a data source RiceQuant and I want to specify different partition schemes for the same data source. daily data: partitioned by year minute-level data: partitioned by year/month and stock ...
molddd123's user avatar
  • 305
0 votes
0 answers
12 views

How to change primary key in AspNetUserRole in identity, and implement one primarykey

public class ApplicationUserRole : IdentityUserRole<string> { } public class IdentityUserRole<TKey> where TKey : IEquatable<TKey> { public virtual TKey UserId { get; set; } ...
massume dehghani's user avatar
0 votes
1 answer
14 views

Merging a temp_table into another table based on non-primary key

I have a CSV file that I upload with multiple rows. Each time I upload it, I store it in a table called 'tempTable', the primary key, 'file_number' does not exist in 'tempTable'. My function checks it ...
Usman Khalid Mian's user avatar
0 votes
2 answers
191 views

Add Primary key (new column) to an existing table with data

We have a table B which gets data from a another table A (another DB), source table A have introduced a new column and made that as Primary Key, so Now we are making DDL changes to our table to add a ...
pawan rakesh's user avatar
0 votes
0 answers
52 views

MySQL table disk layout

I am new to MySQL and I'm trying to understand the physical layout of records on disk. For example, in Postgres the the CTID indicates where in physical storage each row (tuple) is stored. Is there a ...
Dev K's user avatar
  • 51
0 votes
1 answer
51 views

unable to use insert select command

I am not able to insert two columns from 2 different tables into a new table. Both the columns are primary keys and are referenced as foreign keys in the structure of the new table.they are not ...
aman saji's user avatar
0 votes
0 answers
176 views

Laravel 8 migrations primary key issue

Today I made new migration as many times before. The error it threw at me really surprised me. SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "...
Čamo's user avatar
  • 3,870
1 vote
1 answer
47 views

Error Violation of PRIMARY KEY constraint - C#

I have a problem with inserting data into a list. The error tells me that the Editor class cannot contain 2 identical Ids. I understand the error, but I'm not touching that class, just adding an ...
Shi12341234's user avatar
0 votes
1 answer
19 views

Django Error: Question matching query does not exist() Updating Questions and Choices to Primary Keys

I am currently attempting the official Django tutorial polls app. It has asked me to create questions for a poll app and than after that create answer choices. I made a mistake creating the questions ...
user avatar
1 vote
1 answer
45 views

Blocked insert even with Pk constraint with Initially Deferred

I have created a test table : TABLE1(ID -> pk, INFO -> varchar2(100)). I opened the SQL Developer and i changed Pk Deferrable State from "Not Deferrable" to "Initially Deferred&...
Blocked's user avatar
  • 342
0 votes
0 answers
139 views

ALTER TABLE on PRIMARY KEY without downtime or lock table

I'm trying to change the type on the PRIMARY KEY from INT to UNSIGNED INT on MySQL server because I'm nearing the end of the INT range. I tried to make a query ALTER TABLE table_name CHANGE id id INT ...
Adabler's user avatar
  • 34
0 votes
0 answers
17 views

Primary Key doesn't work at Tag Table in Machbase

I create the table as below, set the primary key as the document indicated. create tagdata table tt1 (name varchar(20) primary key, time datetime basetime, value double summarized) metadata (type ...
Xavier Z.'s user avatar
  • 179
0 votes
0 answers
15 views

Cakephp, how to see Sqlite rowid

friends! I'm working with SQLite for the first time on Cakephp and I perceive that the "rowid" field (https://www.sqlite.org/rowidtable.html) is not being retrieved whem I use "Entity-&...
MaLSan's user avatar
  • 11
0 votes
1 answer
96 views

How can I delete from database without the key?

I have a cart table that has cartId as the primary key, userId and itemId. I want to delete every row that has the id of a given user Let's say this is my table: cartId userId itemID 01 5 111 02 5 ...
KK2007's user avatar
  • 21

1
2 3 4 5
91