How to change a primary key in a record

Hi! I would like to change the primary key in my record and use another field instead (the created field would be a concat() from other two fields).

Even though I have been trying, I´m finding trouble when trying to change the condition of primary key and give it to another field. I don´t want this primary key to be AUTO-INCREMENT and, when I try to put another field as primary key, an error occurs. Is it possible to eliminate the primary key and convert the other one into a primary key?

Otherwise, how can I solve this?

  Discussion posts and replies are publicly visible

  • 0
    Certified Associate Developer
    in reply to carlosp5114

    Hi 

    The primary key is a unique or non-null key that serves to uniquely identify every record in a table or relation. In every database, there is a need for a unique identifier for each row in a table, and the primary key plays a vital role in achieving this uniqueness. The primary key column cannot store duplicate values. It is also referred to as a minimal super key; as a result, we cannot specify more than one primary key in any relationship.

    For instance, consider a table named "customer" with attributes such as ID, Name, and City. Only the ID column can never contain duplicate or NULL values because each customer is assigned a unique identification number. This characteristic facilitates the unique identification of each record in the database. Consequently, we can designate the ID attribute as the primary key.

    So that is the reason Primary Key will not get update as default null instead of default none.