Questions tagged [relational-database]

A relational database is a database consisting of relation variables (which are also called *relvars*, *R-tables* or just *tables*). The definition, manipulation and integrity rules of relational databases are based on relational operations equivalent to or similar to the Relational Algebra and Calculus. Relational database principles are the basis of a substantial part of data management theory and practice.

A relational database is a database consisting of relation variables (which are also called relvars, R-tables or just tables). The definition, manipulation and integrity rules of relational databases are based on relational operations equivalent to or similar to the Relational Algebra and Calculus. Relational database principles are the basis of a substantial part of data management theory and practice.

Targeted Questions

This tag is appropriate for questions concerning the relational model, relational and relational database implementation.

The SQL language is commonly used to specify relational database-designs and to define and solve relational database problems. However, DBMSs based on SQL are by definition not s and therefore not all SQL questions are relevant to the relational database tag. Questions specific to or its implementations should be tagged accordingly.

6790 questions
1
vote
1 answer

How to add a foreign key into a table using one-to-one relationship in ASP.NET Core 6 Web API?

I am new to ASP.NET, how can I make my item table save the categoryID which I get from the category table? As an example I want the item "Apple mobile phone" to have the category ID which refers to category name which is electronics, I hope you got…
1
vote
2 answers

How to retrieve and display data with relational DB many to many relationship

This question is about relational database. I am creating an app from the Seatgeek api. Now with many to many relationship you will have to create a junction. Events and Performers have many to many relationship. Hence I created the junction.The…
Doe
  • 47
  • 6
1
vote
0 answers

Hibernate single table inheritance with associations in sub-classes using the same JoinColumn

In my domain model, I would like to associate an entity with other entities based on a discriminator column. For example, an address can be associated to a company or to a person. I would like to have only one table for addresses and selectively…
cskes
  • 11
  • 2
1
vote
1 answer

How do you model a relationship that is dependent on a value?

How do you model the situation where the (foreign) table to which you relate is dependent on a value in the (primary) table? This is the case: I have a table of Risks, and each Risk has a TreatmentType. If the TreatmentType is 'Accept', the Risk…
1
vote
1 answer

Create a dataframe which shows the Relationship between 2 Dataframes

Hello this is my first Question and I tried everything. I'm new to Dataframe and SQL and I have an excel table with multiple Movies. It has the Columns Movie Name, Year ,...,and Actors. In the Column Actors are multiple Actors listet, which are…
Jychnn
  • 13
  • 2
1
vote
1 answer

Creating a unique composite key, where one of its components is a foreign key

I'm using Postgres, and I'm trying to model a scoreboard app (say, where a single person is keeping track of scores for a board game). As an example, Alice is a user on the app that wants to tally scores for herself and her friends Bob, Caden and…
unblevable
  • 1,296
  • 10
  • 14
1
vote
1 answer

How do I configure my Yii model for relational queries?

A bit new to yii and have been having trouble trying to do a join query in my gii-generated model. Summary: I want to return videos (table 'videos') that have met specific search criteria. To do this, I have my 'videos' table, and I have another…
m0rtimer
  • 2,023
  • 1
  • 25
  • 31
1
vote
1 answer

laravel: withCount return me column not found exception

I defined a scope function in an Eloquent model that uses withCount in the query, I also define an unit test for this function that works properly but when I use it in my controller it throws the exception error which is SQLSTATE[42S22]: Column not…
kazemm
  • 473
  • 5
  • 19
1
vote
1 answer

Import XML file to create DB Schema and enter information

I have an XML file from a few datasets which I need to store in a Relational DB, say MySQL. The DB schema shld be created based on the fields of the XML file automatically. What is the best way to do this? I am a novice in terms of XML handling and…
Andy
  • 1,080
  • 5
  • 20
  • 35
1
vote
2 answers

Enforce subset relationship in postgres

How can I enforce the following business logic in my database schema, without using application code: a user must belong to exactly one company a company can have multiple vehicles a vehicle can have multiple companies a user can have multiple…
Arnoux
  • 226
  • 2
  • 9
1
vote
1 answer

mapping relational database to ontology

I’m trying to map a relational database to an ontology. I read many approaches like 1 2 and they all agreed to model bridge tables (join table between two tables connected with each other with many-to-many relationship) as follows: If the bridge…
sary Jou
  • 21
  • 3
1
vote
1 answer

Loading data from dict with nested dicts and lists flattened or as many-to-many tables to sql

To simplify, I have a list as follows: lst = [ { “person_id”: HZT998, “name”: ‘john’, “skills”: [‘python’, ‘sql’, ‘r’], “extras”: {“likes_swimming”: False, “likes_cooking”: True}}, { “person_id”:…
1
vote
2 answers

how to use foreign keys as primary key

i have a table with two foreign keys as composite key. ActivityTbl - (activityNbr(PK), supervisor(FK), status, type, startDate, endDate, location ) VolunteerTbl - (volunteerNbr(PK), name, address, contact) Now I created a table where volunteer's…
1
vote
0 answers

Multiple microservice instances with the same database service

In my recent interview, I got the following question: There are multiple instances of a microservice, each connects to the same relational database (let's say postgres). How can you ensure data consistency and concurrency, if you cannot rely on the…
texmelex
  • 57
  • 7
1
vote
1 answer

how to get relationship data in adonis js

I have a relational model in adonis that I want to retrieve the data (Post belongs to Category). I've set up the relationship in both of migration and model, But when I try to get the category name from the first Post with const posts = await…