Questions tagged [database-design]

Database design is the process of specifying the structure and thus the logical aspects of a database. The goal of database design is to make a representation of some "universe of discourse" - the types of facts, business rules and other requirements that the database is intended to model.

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

should i create one table for all states or several tables?

I'm creating a management system for the company in which appointments and contracts will be entered, these will have various statuses (fixed, already a customer, ok ...). some states are the same for ...
Match's user avatar
  • 1
0 votes
0 answers
12 views

Can we restrict a mongodb user from exporting a database, while having just read/view permission?

I tried to search mongodb docs however I could not find anything relevant I would like to know if its possible or not. If so how? I have a created a user with just read permission, this restricts user ...
TEJ PATEL's user avatar
0 votes
0 answers
9 views

Is repeated factorial anova (3 x 3) the right way to answer my research question?

I'm currently developing an online experiment where people will be rating their sense of duty after reading a vignette. However in order to minimise the amount of time spent for each participant I ...
Angela Wu's user avatar
0 votes
0 answers
22 views

Usage of foreign key as part of composite key or creating a new key (id)? Which one to use when?

Both are valid, but which one should be used when? Here's a little example: Case of AlarmProfileID as prime key Case of composite key consisting of {username and name}
aryan's user avatar
  • 100
0 votes
0 answers
38 views

How to optimise DB schema for a meal planner app?

I am designing a DB schema for a meal planning application. Each meal plan consists of blocks (2 months of diet, 2 months of bulking), each block of meals for the day, each meal of the day of foods. I ...
Honza Sedloň's user avatar
0 votes
1 answer
20 views

Create a record while selecting data from different table in prisma and both have the same relation to the parent table

These are the table model wallet { id Int @id @default(autoincrement()) userId Int @unique balance Int @default(0) joining_bonus Int @default(0) ...
rohit kumar's user avatar
0 votes
1 answer
26 views

The architecture of the task processing system by interval

We have a large list of sites and commands that need to be executed on this site at a given interval in our database. Table: ID, SITE, COMMANDS (json: command_name => interval minutes) 1, example1....
vostok.player's user avatar
1 vote
1 answer
37 views

Postgres CHAR vs VARCHAR crossover variation

In Postgres (or pretty much any SQL database, but I'm asking specifically about Postgres), if you know the content of the field will always be exactly 20 characters, it's obviously more efficient to ...
rwallace's user avatar
  • 31.1k
1 vote
1 answer
24 views

Hibernate queries for combination of column values

I'm designing a schema for products that have multiple variants: @Entity public class Product { @Id @GeneratedValue private long id; @Column(columnDefinition = "JSONB") @Type(...
Kevin's user avatar
  • 1,126
-1 votes
0 answers
39 views

draw ER diagram for shelving management app

I am trying to design a shelving management app. There are two rooms, room 1 and room 2. Each of the rooms contains 3 racks which are made up of shelves. And, the items are stored in particular ...
Kunjan Rana's user avatar
-2 votes
0 answers
15 views

What would be the best architecture to store and search availability by date and hour? [closed]

Im working on an availability / search service that takes into account days and also hours for availability. I am looking for a good architecture to implement (on a high level) An example: We have ...
yael martinez's user avatar
-1 votes
1 answer
29 views

Can I include string values in Fact Table?

I have a fact table called Fact_Employee_leave where each row refers to the Leave taken by each employee referencing to (dim_employee) which is starting and ending at a specific date referencing to (...
Mariam's user avatar
  • 3
-1 votes
0 answers
15 views

Querying from dynamoDB based on a field containing arrays, such that my input array is a subset of the array in DB [closed]

I'm new to dynamoDB , so basically my table has one partition key as of now, that is unique for every entry added. I have a field domains that contains arrays with domains names. I would like to ...
Kevin Tony's user avatar
-2 votes
0 answers
23 views

Database design for tracking student subject performance at topic level with possibly 10 billion rows [closed]

I am developing a test/exam solution where We have around 100K questions (MCQ / Objective Type). Each question belongs to a topic and each topic belongs to a subject. Students practice these ...
Sudhir N's user avatar
  • 4,012
-1 votes
0 answers
16 views

which db to use to store timeseries data that needs to be streamed together

Suppose that I have the following tables: data1: +-----------------------+---------+---------+-----+---------+ |timestamp | p_1 | p_2 | ... | p_n | +-----------------------+---...
MoneyBall's user avatar
  • 2,329
-1 votes
0 answers
43 views

Translate a (1,N) <-> (0,N) relation in PostgreSQL with Constraints

I'm designing a Database which requires a Many-To-Many relationship between two entities, but this kind of relationship can't be empty for one entity at any time. I'm trying to do this in PostgreSQL, ...
Ghimbo21's user avatar
  • 125
-1 votes
0 answers
17 views

SQL (Hive) query using 3 tables

table1: main_id sub_id start_post end_post table2: sub_id soft_ver (output) table3: sub_id area_id soft_ver lt_flag (output) How do I display the contents of table1 only when table1.sub_id = table2....
z00110011's user avatar
-1 votes
0 answers
23 views

Looking for term or example of a specific database structure [closed]

I am unable to find a term or example of the kind of database structure that I am looking for. Our workplace assembles and services large mechanical equipment. We have a database that currently ...
Sluggo's user avatar
  • 1
-1 votes
0 answers
15 views

How to model the data from the Riot API for the challenges endpoints for an RDBMS?

I'm currently working on creating tables in a postgresql db to hold data from the Riot API for league of legends. I want to be able to query for specific challenges and order them by challenge ...
James Moles's user avatar
0 votes
1 answer
33 views

How do I keep auto-generated columns in PostgreSQL even after removing the source columns?

I have a table that has autogenerated columns: -- function that creates GEOGRAPHY point from given inputs create or replace function create_point_geography (long DOUBLE PRECISION, lat DOUBLE ...
ABDULLOKH MUKHAMMADJONOV's user avatar
-1 votes
1 answer
55 views

How to autoincrement ID value when there are 2 primary keys in an SQL table?

I am making a social media app that includes posts and comments, therefore I created Post and Comment tables. Comment is a weak entity, so that it has 2 primary keys: comment_id and post_id. When ...
chagatai's user avatar
-1 votes
0 answers
12 views

How to model n to m relations in an ER-Diagram? [duplicate]

I'm wondering, if there is a n to m relationship in an ER-Diagram, is there a way to model it without creating an additional table for this relationship? For example, the answer to this question: ...
theotechnic's user avatar
-1 votes
1 answer
20 views

How to find missing inter-relationships in a family if I have one element mapping to all others. How to store relationship among each other?

I have to design an application where users have their family members, with their relationship among them denoted in the app. If I log in as father in my app, I see my son name and relationship ...
user19742850's user avatar
-1 votes
0 answers
20 views

Design global application settings table [closed]

I am developing an application and found that I probably going to need some sort of settings table so that admin can set up global settings for app. That might be for example default pagination size ...
Martin Agnar Dahl's user avatar
-2 votes
0 answers
23 views

should i combine two tables with same attributes?

I have two tables with the same attributes but different meanings. (country name, population, area, country specific attributes) (city name, population, area, city-specific attributes) Should I ...
Ryan Lam's user avatar
2 votes
1 answer
43 views

Azure SQL Design Recommendation

I have use case where I have a job which insert around 30 million rows every hour. It's kind of snapshot we are taking for some data source and we are intersted only on the latest snapshot for ...
Bad Coder's user avatar
  • 834
0 votes
0 answers
20 views

Update Data Structure - Spring Data JPA

Propose the given situation : public class Data implements Serializable { private static final long serialVersionUID = 1L; private final String data; public Data(Double in) { this....
SwordOfSouls's user avatar
0 votes
1 answer
13 views

How can I run multiple caller rights procedures with CREATE & GRANT statements using a single role on Snowflake?

Let's say I have a few stored procedures on Snowflake to automate role creation and grants, schemas and so with CREATE ROLE, CREATE SCHEMA, GRANT statements. If I wanted to create those procedures ...
user18243519's user avatar
0 votes
2 answers
38 views

Unique Constraint group similar values

Let's say I have a database with columns name, last_name and type They're all strings, though type can only be TYPE_A, TYPE_B or TYPE_C I want a row in the database to be Unique when name and ...
Phi Tiet's user avatar
-1 votes
0 answers
14 views

Table/API design for tags/tagging for like-terms (synonymous)

I have an events table and a tag table. Events can be tagged. Let's say I have the following events with their tags. eventA {alcohol, social} eventB {wine, private} eventC {hiking, outdoor} eventD {...
Kousha's user avatar
  • 32.3k
-2 votes
0 answers
25 views

What is a way to calculate session time between two parties and end the session automatically if user has low balance?

My goal is to calculate the session time (text/call/video) between two parties so that the total amount based on the per minute charge could be deducted from the users current balance. The session ...
Kanishk Garg's user avatar
-1 votes
1 answer
33 views

How do I create a staging and production environment for the data within a database? Database/API/application architecture planning

I have two applications that will be going through my API and interacting with my database(s). The first application displays production data that the customer can view, this has been through a QA ...
DnR's user avatar
  • 1
0 votes
1 answer
30 views

How do a create an array subdocument that references "guests" from another model at a future date?

I have an events model where guests can "signup" and join the event. Each event is a contest so it has a max amount of "guests" for each as certain slots are labeled as "...
econobro's user avatar
  • 313
0 votes
2 answers
57 views

At what layer i should determine if something does not exist [closed]

Suppose I have a Comment entity defined as follows: public class comment { public int Id { get; set; } public int TopicId { get; set; } public string Text { get; set; } ...
yyhnfd's user avatar
  • 33
-1 votes
0 answers
41 views

Database revision vs Event sourcing for tracking changes of entity changes

We are developing a platform where there is the possibility of booking hotels. The booking process can consist of various operations: creation, change of dates, cancellation, confirmation, and so on. ...
taraslis453's user avatar
-1 votes
1 answer
19 views

Probleme schema Design mongodb nodejs mongoos

Im trying to create a knew schema mongodb like this : `const badgeSchema = new Schema({ emt: { type: String, required: true }, modele: { type: String, required: true }, code: { type: String,...
Amine Gabsi's user avatar
-1 votes
1 answer
15 views

Primary key in relational database while working with orm like sequelize

Currently I'm working in nodejs project where I'm using sequelize ORM to interact with Postgres database, so in database tables should I use custom fields as primary key while working with ORM like ...
Aditya's user avatar
  • 1
0 votes
1 answer
41 views

UML ERD Database modelling Query [closed]

I have the following tables in my database. (Member) is assigned to 1.m facility (Facility) has assigned 1.m member (Facility) enrolled to 1.m program (Program) enrolls 1.m facility I want to query ...
David Garcia's user avatar
  • 3,028
-2 votes
0 answers
27 views

Relationally representing and constraining "recipe instance" in an SQL database and linking instance to ingredient batch

I am attempting to represent a "recipe instance" in a relational SQL database with the constraint that a recipe instance is linked to each ingredient batch making up the recipe. I am unsure ...
alluppercase's user avatar
-1 votes
0 answers
27 views

Query to identify parent in Query on the M2O, O2M, M2M, M2A relation

Context: If we have an item from the collection A, which it is related to the collections N, then return all the collections N where this item is related until find the top parent. In the middle there ...
andersonCopa's user avatar
-1 votes
0 answers
21 views

Database design: how to design it for time series data

As this question might look straight forward i have pretty specific case that i can't figure out. I want to Build SQL Database with simulation data. I have a time series data of position x, y, z that ...
Mateusz Kiersnowski's user avatar
-1 votes
0 answers
28 views

Sticky thead and horizontally scrolling the table body with the table head

In the following demo, I have a table that requires a specific scrolling behaviour. The problem is to keep the table header sticky at the top while allowing horizontal scrolling for the table body in ...
Vecot's user avatar
  • 19
-1 votes
2 answers
31 views

provide field name dynamically in where clause in query

I have a table that reads day_sunday, day_monday, etc. I need what data is stored for today's column if the value is true. For example 17 may is Wednesday so the query will be For example 17 may is a ...
Charmi Chavda's user avatar
-1 votes
1 answer
30 views

Better understanding DyamoDB compound sort keys

I'm trying to understand how use compound sort keys as discussed in this video. I understand the concept of chaining values together in this key to make querying for data more efficient, but I don't ...
Zach Kaigler's user avatar
-1 votes
0 answers
29 views

Sql Server query optimization, SELECT statement turns into INSERT statement

The following query displays the value of the orders that had been placed up to the end of 1993 and had to be shipped to customers in the first two months of 1994. The orders appear in descending ...
Anna's user avatar
  • 41
-1 votes
0 answers
27 views

insert documents with a schema with certain columns/fields

My assignment is to insert documents whose contents are consistent with the schema into the collection prefix. What should be added to the script below to be able insert documents with a schema with ...
Bryead's user avatar
  • 118
0 votes
1 answer
51 views

Does postgres hash string based primary keys under the hood?

I'm wondering about whether I could theoretically run into trouble if the IDs of rows are generated in a non-uniform way. Could I run into an issue where it's hard to shard the database table based on ...
david_adler's user avatar
  • 9,370
0 votes
0 answers
31 views

Firestore: Listen for document changes and store realtime data in Provider using Flutter

Current Situation In my App I use Provider for state management and Cloud Firestore as database. Until now I used simple get querys to fetch data from Firestore like below: class Database { final ...
Dalon's user avatar
  • 556
0 votes
0 answers
19 views

Maximise Functional Dependencies (FDs) from a canonical set of FDs

I am trying to apply the Boyce-Codd Normal Form (BCNF) Synthesis Algorithm. The first two steps are Compute the canonical set of FDs (this is given) Maximize the right-hand sides of the FDs: Replace ...
Michaël's user avatar
0 votes
0 answers
17 views

How do I add item to the list of items in the invoice with the requested item quantity without changing the existing quantity of the item in db

`So now I want to be able to set the values of the item to add to item list in the invoice with the values in the addItemToInvoiceRequest, without affecting the values of the optional item returned ...
Okoro Jeremiah's user avatar

1
2 3 4 5
480