Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [relational-database]

A relational database is a digital database based on the relational model of data. This model organizes data into one or more tables (or "relations") of columns and rows

0
votes
1answer
66 views
+50

Application/Database design where two tables have both 1-to-many and 1-to-1 relationships

I have an application where the requirements are to show a list of (just for example) car manufacturers. When you click on one of the manufacturers, a list of car models show up. You can then click on ...
0
votes
0answers
60 views

At what point in design do you create a new database or just keep adding tables [closed]

My question is at what point should you create a new database and why? So after many years of creating small projects I have come to the realization that I have way to many db's. Now it's not a ...
0
votes
0answers
37 views

Designing database relationships for a voting application

So I designed database relationships for a voting/polling application. I want a user to only be able to pick 1 option on a poll. I want multiple options per poll. So what I have here is this. User ...
0
votes
1answer
45 views

Updating sub-properties via Entity Framework

I was wondering how to updated nested objects/sub-properties when using Entity Framework. But to make things clear, let's start with an example. I have an object, which can own a number of other ...
1
vote
3answers
99 views

Is there a viable methodology for using a relational database without an Object-Relational Mapping tool

I'm beginning a small Web development project (maybe 20 tables initially). I would like to use a relational database for transactions, SQL, indexes, etc. I have limited needs for true objects, though. ...
1
vote
0answers
21 views

DataBase design generated by hibernate Many to Many for MariaDB

Hi I am in middle of designing DB and Got a little bit confused about DB Design. I am Using Hibernate as ORM Tool ahd mapping between Page and Step entity in hibernate. @ManyToMany(fetch = FetchType....
0
votes
4answers
175 views

Relational DB design: Should I skip a table with only 1 column that create relationship between 2 other tables?

I must design a database that store items that can be associated to a production. Production is only a identifier with no common attributes. But, a production may or may not have attributes (which are ...
1
vote
1answer
39 views

Storing answers of a form builder where question sections may be repeated N times

I built a form builder with which administrators of the system I work on can build forms (or blueprints as we call them). The structure of these blueprints are as follows: blueprint X section 1 ...
-2
votes
1answer
44 views

Preuso/empty entity or only real entities + nulls?

I have a table "products" and a child one "product_modifications" Some products have "product_modifications": "colour", "size",, .... But not all. When a client orders a product, views pictures and ...
-3
votes
1answer
103 views

Can a Database Scale Up? [closed]

Microservices are the latest software development craze. All the kids are doing it. When I started hearing about the concept, the first advantage that came to mind was the single responsibility ...
0
votes
1answer
62 views

How to create a flexible datamodel?

I'm trying to create a flexible datamodel and i'm not sure what's the right approach. My application is used by several clients (big and small). Big clients need all the seperate layers, but small ...
11
votes
5answers
711 views

My team is scared of relational database entities with foreign key relationships and I don't understand why

I'm relatively fresh out of college so most of my familiarity with relational databases is from my databases course where anything not in BCNF or 3NF is a travesty. Certainly that's one end of the ...
4
votes
1answer
147 views

Should I comply with SRP when designing relational tables?

As far as I know, the single responsibility principle concerns functions, classes and modules. Now I am designing a database and I wonder if this principle should be applied to relational tables. ...
0
votes
2answers
72 views

What is the best method to avoid company data duplication in mixed B2C and B2B product in account creation?

I'm building a user license portal, store, SSO, and mini CRM and admin for internal people to manage those users for a niche 3D software company, similar to Autodesk. Licenses are sold to both ...
0
votes
1answer
44 views

Database design for a survey app [closed]

I'm creating a survey app and I don't know how to design database. I need surveys with multiple questions and multiple types of questions. There are 3 ways that I could think of: a) Create a ...
1
vote
2answers
74 views

Reporting with cyclic or relationships

I’ve got me a design and implementation problem extracting and formulating the results I need. What I’m trying to do is build some reporting on forecasted stock commitments in an inventory system to ...
0
votes
1answer
34 views

In a parent table - Child table relation , where to store order of children

Assume a Parent -> Child relationship in RDBMS. questionnaire table and question table. question table has a foreign key questionnaire_id to store which questionnaire it belongs to. Questionaire ...
2
votes
2answers
117 views

How to structure database for daily events?

I'm storing data which logs whether or not a user has logged their attendance for a given day. Some days are unimportant (holiday, weekend), so those are also stored. The two requirements are that: ...
1
vote
3answers
93 views

Database relation design

When I develop apps I reach situations like this frequently but I never found a best practice to solve it. Imagine: We have chats, each chat can have many message. We have tickets, each ticket can ...
1
vote
1answer
55 views

Using UNIQUE (col1, col2) or using a composite primary key for a relation table in SQLite/SQL?

i’m working on a project where i’m using SQLite and where i have a few relation tables looking similar to this one: CREATE TABLE tag_entry_relation ( id INTEGER PRIMARY KEY, tag_id INTEGER REFERENCES ...
2
votes
2answers
72 views

Index / Unique on `deleted_at` column?

We have an Accounts table in a Postgres DB that has a unique index on user_id and product. Users can have many accounts, there's no product table. Occasionally users will create an account ...
2
votes
3answers
520 views

Database : Does it make sense to choose the zipcode as a primary key for an address?

I was following a tutorial on the normal forms of SQL databases, and I got confused landing on this example : https://www.tutorialspoint.com/sql/third-normal-form.htm. From CREATE TABLE CUSTOMERS( ...
2
votes
1answer
70 views

Proper way to associate data to users that are stored in external database?

I have this IdentityServer which handles authentication and authorization. It saves users, roles, claims, etc in its own database. Then, I have a web app that needs to protect some resources to ...
91
votes
9answers
16k views

Is it ever okay to use lists in a relational database?

I've been trying to design a database to go with a project concept and ran into what seems like a hotly debated issue. I've read a few articles and some Stack Overflow answers that state it's ...
0
votes
2answers
258 views

Is there any benefit in having more than one table for storing the same type of objects?

Lets say I want to store songs in my database. Instead of having just one Song table, I have ten tables. The Song table also has a foreign key to the Artist table. When an artist is added to the ...
-2
votes
2answers
45 views

database/orm model design for contacts

I am building a internal crm which has contacts which are just people with first name, last name, email, phone etc. Contacts can be one or more types e.t.c. job candidates, hiring managers, customers, ...
1
vote
1answer
86 views

Best way to model pricelist per customer for products in webshop

I am making a b2b-webshop system that will have multiple customers. Each customer will have a separate active pricelist which contains the products that they can buy and the prices that applies for ...
1
vote
3answers
173 views

Who guarantees the data integrity of a denormalized table, me or the DBMS?

In the following database, School_has_Student is a denormalized table : Now if I decided to change the "paul" student name to "john" in the Student table, then the "paul" student name that exist ...
1
vote
4answers
200 views

When denormalizing a database, do I need to keep the parent tables?

Say I have the following ER diagram: To implement the above ER diagram as a normalized database, I would create a School table, and a Student table, and a School_has_Student table (that only contains ...
-1
votes
1answer
46 views

Databse model: Entity that can have values from two different tables or user input values

I'm modeling a database, where I have a table called "appointments" (citas in spanish, but I would translate the tables's names for better understanding) where the user can create an appointment to ...
4
votes
1answer
155 views

What tactics to use to load the referenced data in repository implementation?

Say that I have a repository that is used as READ-ONLY data provides (never for the writes/updates) - the query part of the CQS, NO event sourcing, hitting relational DB. One of the essential rules - ...
-1
votes
3answers
105 views

DB architecture for managing items of different categories

I'm making a rental app which has many categories with unique properties Example: Category 1 Car which has Fuel, model, color, speed Category 2 Apartment which has Rooms, lift, ...
2
votes
2answers
409 views

How to design a relational database where users can create custom fields

Ive been looking around for a way to design a database for large amounts of leads (users) with custom fields. Ive check this out (How would you design a user database with custom fields), but this ...
3
votes
2answers
176 views

Is using -1 as a special Id a good idea in SQL?

I'm trying to determine if using '-1' in an Identity column has any drawbacks, or if there is a better way to do what I want. In my database I have User table and a Group table. All users must belong ...
2
votes
1answer
381 views

How can I turn my CRUD database application into a REST application?

I may have gotten myself confused, when reading CRUD vs REST and how they are similar, so I wanted to explicitly ask: can I turn my CRUD application into a REST application, when I have a specific ...
3
votes
4answers
263 views

DB Enumerations vs App Enumerations vs Lookup tables

We started a project recently, and during the design process, we have some arguments among team members. We have to deal with enumerations so we ended up with three choices. Have the enumerations as ...
1
vote
3answers
62 views

Is this implementation for the “one” side of the relationship correct?

Say I have the following ER diagram: The "one" side of the relationship of the above diagram means the following: Each student can meet 0 or 1 teacher. So I can't do something like this: But can I ...
0
votes
3answers
177 views

Does the “one” side of the relationship also apply to the same record?

Say I have the following ER diagram: What I know is that the "one" side of the relationship means the following: Each student can meet 0 or 1 teacher. So for example student3 can meet teacher7, but ...
2
votes
1answer
223 views

Web application with relational database - best practice?

I am currently designing a web application which is pretty similar to Twitter but with some unique features for my company. Technologies are Vue2, Spark framework and PostgreSQL. I am trying to ...
6
votes
3answers
213 views

How to solve form submission consistency in a web application?

Imagine that you have a form with which you can edit some data, let's call it a Person form. Let's imagine that a user opens up this Person form, receives the current data that is stored in the ...
-2
votes
1answer
141 views

Relational Database Design with a table having redundant information

I am creating a database table that will store a single number 1 thru 16 in 2 fields (there will be many rows of data). I'm trying to avoid duplicating a lot of data and make my dbase most ...
1
vote
1answer
85 views

Which datastructure to use for temporary storage of intermittent and asynchronous sensor data?

Here an outline of the setup: Input data: I have several sources for sensor input data (GPS, and a bunch of other sensor data from different sources). All of those individual inputs consist of a ...
4
votes
2answers
160 views

Is it okay to structure a non-normal table in relational database to achieve a fast query?

Let's say we've got 3 entities here, User, Tag, Track and a single associative entity called Tagged. I need to count a tag frequency of a track and the common way is to count the record of tagged, ...
1
vote
0answers
131 views

How to maintain table relationship across services in with a micro-service architecture

I have a scraper service that looks for media online. For every source type, there are two tables. A common source table and a source_type_media table that are related by source.id to ...
0
votes
1answer
33 views

Extending photo album app with videos

I have a personal photo album application where I upload my photos. However, I'd now like to extend it with videos as well, and I'm unsure how to properly perform this extension. The current design ...
0
votes
5answers
278 views

How to create a db schema for “if this then… elseif … elseif …” and so on?

I want to create an app where a user will go through a series of steps every day. All the subsequent step will depend on the previous ones, that is, 2 users can have different experiences depending on ...
3
votes
2answers
4k views

Why should I use foreign keys in database? [closed]

In my 10+ years of experience in the IT field, I have never used foreign keys in any of my project and I never felt the need. I did work with professional databases which had foreign keys constraints. ...
2
votes
3answers
252 views

Database design for generic behaviour

I have a few tables that are generic. One of them allows a user to comment on something, and the other one allows a user to favorite something. Initially, I had thought that to make it possible to ...
1
vote
1answer
74 views

What are good ways to encode order between records of a relational table

For example, when an issue tracker offers the functionality to users to keep a prioritized backlog of tasks and used a relational database for persisting this information, what are effective ways to ...
0
votes
0answers
470 views

Use of UUIDs (Primary key) in a REST API

I faced the problem bellow when I designed our new app. We are thinking to have one extra column for some tables which is a UUID for security purposes. So, there are two different solutions. First ...