In my attempt to model a one to many relationship, I am trying to achieve the following in SQL (MariaDB) given my basic DB knowledge:

Profiles Table:
Primary Key: profileName <-----
Repositories Table:           |
Composite Primary Keys: (profileName, repository_name)

Is this a possibility?

1 Answer 1


This is certainly possible and even very reasonable in many situations. Think for instance to the classical Order and OrderLine tables, in which the OrderLine has as primary key the order number and the line number, with order number foreign key for the Order table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.