All Questions
Tagged with database database-design
9,379
questions
0
votes
0
answers
29
views
Need to determine whether different question types for a questionnaire are many-to-many or one-to-many
We need to survey our contacts by asking them various questions and recording their responses. Some questions are standard and must be included in every survey (default questions), while others are ...
0
votes
0
answers
10
views
In a social media relational database schema, should I use separate tables for posts likes and comments likes?
I have a social media app with users, posts, and comments, in which users can like posts and comments.
Is it best practice to use the same table to store the likes of both, such as:
user_id
post_id
...
1
vote
1
answer
36
views
Why is read repair not sufficient in making dynamo-style database linearizable?
I am reading DDIA. It says "possible to make Dynamo-style quorums linearizable at the cost of reduced performance: a reader must perform read repair (see “Read repair and antientropy” on page 178)...
-3
votes
2
answers
54
views
one-to-one mandatory attendance relationship
As shown in the diagram, there are 2 tables with a one-to-one relationship and mandatory participation. Can you help me implement this as ddl code? I could do it easily when there was no mandatory ...
1
vote
2
answers
64
views
How to system-design paying a payment with multiple currencies
I am developing an accounting app where users can have a product with currency A. The value of the product can be escrowed using a cheque payment with currency B and this cheque payment can be paid in ...
-1
votes
0
answers
30
views
Parent-Child relationships where parent and child tables may change based on settings
I am developing a Warehouse Management System. Each Warehouse can specify storage locations by varying degrees of specificity: Zone, Aisle, Row, Rack, Shelf, Bin. While Bin is always required because ...
-2
votes
0
answers
35
views
Normalized database structure would result in the lowest-level types containing huge amounts of data
I'm using Xano as my database management system.
Here’s how my website content is structured:
- Company (first level type)
-- Division (second level type)
--- Team (third level type)
---- Employee (...
0
votes
0
answers
19
views
Product variant but has other variation
I have product table and produk variant
But I want that product variant has other options again
This is my product,
I have a custom cloth that has types of collars , cuff, pocket, plackets, fabric
But ...
-1
votes
0
answers
26
views
Real estate database design to save listings of different types [duplicate]
I am creating a website similar to this website. My website needs to allow users to save different kinds of listing like home, plots. offices, shops, agricultural land etc. My question is how to ...
0
votes
0
answers
35
views
How do I setup baserow such that I can migrate data from one table to another?
I am new to base row and I would want to set up a system such that a record added to one table is automatically copied to another table.
I can't really go into too much detail but for example, once ...
0
votes
0
answers
47
views
How to count the number of read/write units being used on KV?
The free plan of Deno Deploy gives me 450,000 read units and 300,000 write units per month. One read unit is equivalent to 4 KiB of read. If you read a 2 KiB record this is 1 read unit. If you read 4....
-1
votes
1
answer
54
views
Whats the best way to design an event table where different event items are provided each time the event updated
I have a raw event table that I'm working with. It has two columns date and metadata. Metadata has raw json dump of all the event attributes. But I'd like to make it clear that each time different ...
0
votes
0
answers
9
views
How to design data consistency check rules
Data Reconciliation Rule Generation
Background:
In the process of e-commerce shopping, when a user places an order, data information will be stored in different systems' tables such as order table, ...
2
votes
1
answer
36
views
Can i add new nodes and increment n_val in Riak kv?
I intend to make a desktop app for a company that has multiple gyms at different locations,where a client who registered his membership at one gym should be able to access all other gyms with the same ...
0
votes
1
answer
31
views
Database Engine to support Column References [closed]
I need to design a database/data warehouse that supports analytical queries on multiple tables. To simplify the problem, let assume two tables:
Orders(
id int,
company_id,
amount float
)
...
0
votes
0
answers
60
views
SQLite Strict Mode or any other alternatives
I am currently developing a QT C++ Application for my friend's shop. Simple application for inventory management and billing system. So, the DB will be in his computer itself which also hosts the ...
0
votes
0
answers
18
views
How to organize DB's structure
I have hardcoded (a lot of) phrases with some errors. After program did its work, it returns the result that I need to compare with one of the hardcoded phrase and choose the exact same.
I need to ...
1
vote
1
answer
90
views
What is the method to remember a "1 to many" relationship database change history?
I have basically two tables in the database, one is named "Valve", and the other is named "Channel". This is a basic "1 to many" relationship, which means one Valve can ...
1
vote
1
answer
69
views
Merge many large tables in PostgreSQL
I have 150 tables with the same columns representing areas in a country. The size of each table is millions of rows and tens of GB in size.
I want to combine all the tables into one with the aim of ...
1
vote
2
answers
74
views
Cardinalities for ternary relations in ERD diagram
Re that ERD:
I can represent a many-to-many relationship with m to m.
What is m to n in the ternary relationship?
Can I use it in a binary or unary relationship?
What does it mean?
What is m to k?
Can ...
0
votes
1
answer
42
views
MongoDB best practices for many sensors (+50k) but slow updates (every 12hrs)
I am trying to get some advice on how to appropriately structure my MongoDB Database. I am on Mongo Atlas M10 and my data structure looks like this:
{
sensorId: "12345",
epoch: Date,
...
1
vote
1
answer
34
views
How can I delete a document from firestore while maintaining my database model?
I read this article, and if you find any of my explanations obscure, please refer to it. Basically, the idea is that you assign a last_modified field to each document that gets updated with the date ...
0
votes
0
answers
45
views
How to create an ER diagram: database design challenge
Is this correct or not?
I'm trying to create an ER diagram for an online food delivery app. Now, I'm unsure if the diagram accurately represents the system.
0
votes
1
answer
24
views
How to get the diamond on Siebel erd?
I'm trying to recreate this image, however I can't find the diamond option between the relationships of the entities. How can I do this?
I've tried going through the relationship properties and ...
1
vote
1
answer
23
views
Depicting different shapes of the same real world entity in an ER Diagram
Given an entity A represented by tableA, that I am going to perform certain transformations on (e.g. pivot, standardise) and store/materialise in a second table tableB should I depict an entity B for ...
0
votes
1
answer
35
views
Dependency Cycle in Database with Update Approvals
I'm struggling with a dependency cycle in my SQL database schema for a system with update approvals. Here's the situation:
I have tables for documents , transactions, payment_methods, and ...
0
votes
0
answers
20
views
Compare price and bying price of variant product
I am going to build a database e-commerce, everything is ok except for the variant price. According to many forum, I have seen them desigining database just with price of variants like:
id
product_id
...
0
votes
1
answer
36
views
Designing SQL Postgres Relations Table for Editing Entered Documents and Undo Functionality
I'm currently working on a system where users can edit entered documents in a PostgreSQL database. The functionality entails allowing users to click on a document to edit it, effectively creating a ...
0
votes
1
answer
116
views
Best practice for draft/published states
I'm building a CMS and trying to figure out the best data architecture to handle a "save as draft" functionality.
Let's say I have a post table. I need to be able to save a post as a draft, ...
0
votes
0
answers
30
views
Adding versioning in star schema design
I am in a situation where i have to add version in existing dimension tables . For eg.
I have 7 dimensions tables and a fact table (with total existing data of 500GB)
Now the requirement is dimensions ...
1
vote
1
answer
98
views
How to implement a wide multi-level self-join PostgreSQL query?
I have several rows that represent a person. Each person has a column for bio_mother _uuid and a bio_father_uuid. I used this page (I mention that because it's referenced in this similar question) to ...
0
votes
0
answers
18
views
When an E-R attribute should be perceived as a relationship attribute or as an entity set attribute?
Aspects worth to consider from the very beginning:
In order to maintain the degree of simplicity of the problem this post presents, I haven't provided the exact requirement, on the basis of the ...
0
votes
1
answer
41
views
Can i create a table with 2 foreign keys? These 2 foreign keys are 2 primary keys of 2 different tables
I am planning to create a table with 2 foreign keys. These 2 foreign keys reference 2 primary keys of 2 different tables. However, one of the two foreign keys may be null due to business reasons. So ...
2
votes
1
answer
74
views
how can i calculate mutual friends/followers efficiently?
i need to calculate mutual friends between users, right now it is working fine, but i don't think it will work for users who have a large follower base, it will take a long to load and compare. please ...
1
vote
1
answer
75
views
Use conditional constraint or normalize table?
I have two entities: A and B. The latter has two types B1 and B2. Their relationship is:
(A,B1) is (1:1)
(A,B2) is (1,N)
When creating database tables, I wonder how is the best way to guarantee ...
0
votes
1
answer
54
views
Design SQL Schema for User Interests
I'm trying to find the best approach for designing sql schema for the following scenario:
-A User can have multiple interests
-The platform provides predefined interests from which the user can ...
0
votes
0
answers
59
views
How to assign multiple Foreign keys to one box in an sql table
I have created a database that has one table that keeps track of employee skills and another which displays projects that these employees can be assigned to.
I need to have multiple employees asigned ...
-2
votes
2
answers
56
views
How to delete only orphan child rows with ON DELETE?
I have a parent table and a child table. A parent row stores the foreign key to the child row. If I set the constraint on the foreign key to ON DELETE CASCADE then that will throw an error when I want ...
0
votes
0
answers
24
views
How to Handle Dynamic Priority Updates in Firestore [duplicate]
I'm managing a list of 10,000+ items in Firestore, each with a dynamic priority that frequently changes. Initially, I stored items in an array within a single document, but this approach struggles ...
0
votes
0
answers
99
views
Database Design for storing Key-Value Tags per Item
I want to build an online shop where the products don't follow a specific schema, so the attributes can be quite different for each product.
My idea is to allow the sellers to define custom tags with ...
-1
votes
1
answer
83
views
Separate tables based on business goals
Is it worth to split tables bases solely on the business goal?
NOTE: The tables all have identical columns.
1. One table
One orders table, with a orderType column to differentiate them.
2. Two tables
...
0
votes
1
answer
35
views
Database relationship PK table to PK, FK table
Database relationship PK to PK, FK
I have some tables in a database and I am trying to figure out the relationship between them,
Customer: PK CustomerID
Agents: PK AgentID
Listing: PK ListingID
...
0
votes
0
answers
70
views
Were the entity sets and their associated relationships accurately and properly constructed?
To be considered:
The bolded terms that appear across the requirement I laid out bellow are the ones included in the entity set (Vehicle) I created.
I also specified the attributes nature/kind/type.
...
0
votes
1
answer
119
views
Large store database design in Laravel
I have a Laravel store project that I am confused to develop my products database. My store products are clothes, shoes, pants, laptops, phones, headphones, etc.
Hello friends, good time
This database ...
0
votes
0
answers
53
views
In DynamoDB single-table design, should the shard lookup be in a separate table?
I'm trying to design a multi-tenant single-table in Dynamodb. My primary key needs to be the tenantId for all items so that I can enforce tenant isolation. The PK potentially faces hotkey issues due ...
0
votes
1
answer
47
views
"Using index condition; Using where" explaining my query, with proper indexes?
From the manual Using index condition; Using where:
By accessing index tuples and testing them initially, tables can be
read while deferring the reading of full rows until it is essential.
I've the ...
-1
votes
1
answer
130
views
How to prove that two data models are logically equivalent?
Suppose Alice has a data model:
Person: {
id: int (unique not null),
name: string,
phone_number: string
}
Bob suggests that Alice could also use the following data model:
Person: {
id:...
1
vote
2
answers
159
views
How to specify relation based on a condition in Entity Relationship Diagram (ERD)?
Suppose I have a table named User (Entity), whose attributes are _id, name, email, user_type [enum: "normal user", "admin", "volunteer"], address, and age. also, I have ...
-1
votes
2
answers
39
views
how to have a calculated field viewable within a form in real time?
How do I have a database field that provides a calculation in real time, i.e when the user is entering data into the form?
I tried to run an afterUpdate event from the field in the form labeled ...
-1
votes
1
answer
36
views
Storing Database Password
If I save the password to the database as a hash in the configuration file of the application or in the code for security reasons, how does the application connect to the database if it does not ...