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.
database-design
24,112
questions
-1
votes
1
answer
34
views
The best data-model to store nested tags? [duplicate]
I'm trying to make a breadcrumb for a ecommerce website. Something like this:
Home > Kitchen > Serving and reception > Spoon
Each of those item are a tag. So, the tags table is parent-based/...
0
votes
1
answer
40
views
What is the recommended collation for a PostgreSQL unique e-mail column?
Most places recommend for unique e-mail indexes using either a lower(email) index, or a datatype citext.
But the manual for citext suggests using a collation for all cases instead of citext now:
...
0
votes
0
answers
21
views
Postgresql SELECT optimisation into Django ORM
Please see below a PostgreSQL SELECT statement. This presently returns around 300k rows, which is the grouped result of several million underlying rows. The dataset is only going to get larger. Using ...
0
votes
0
answers
19
views
Error: The server does not support SSL connections when running drizzle-kit studio
import { migrate } from "drizzle-orm/postgres-js/migrator";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import { env } from "....
-1
votes
2
answers
63
views
Count on LEFT JOIN in SQL
I would like to know how can I get Count on LEFT JOIN in SQL.
Currently I have 3 tables :
rooms_messages
id
room_id
discussion_message_id
created_at
1
10
101
2024-07-16 12:30:45
2
20
102
2024-07-16 ...
-1
votes
0
answers
32
views
Avoid null in fields for 3NF database design
This JSON depicts the design I am trying to come with in a database.
How do I design it without having null values?
{
"id": 12,
"name": "Potato Chips",
"...
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
...
-2
votes
0
answers
51
views
MYSQL/Rails Database design for linked objects best practice? [closed]
I have a ruby/mysql question inquiring what the database structure best practice is:
A - The set-up I have 2 objects, (e.g., employees and documents), in this example, I would like to allow some ...
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
0
answers
43
views
How to restructure a schema in order to support conditional (one of two tables) relations
I've been stuck on this for a while now so I decided to ask for some help.
My SetTemplate needs to EITHER be connected directly to exerciseTemplate OR connected to exerciseTemplate through a ...
0
votes
0
answers
25
views
Utilizing json if/then to require a parameter if not specified?
So, I've got a json that has a handful of initial values, but as a user story I need to allow adjustments per point/object rather than at the top.
{"properties":{
"p1":{},
&...
0
votes
0
answers
22
views
Database Architecture Advice for a complete newbie
I've used databases at a basic user level for a decade, but have never really thought about structure and i'm looking for some advice.
I have a list of contacts that are currently in an excel file ...
1
vote
0
answers
69
views
How can i "add" additional Data (Classification-Codes) to an existing Field
I have build a model which should representate our Products at work. Our products are different sorts of luminaires. Some of these with different variations like different colour-temperature, ...
-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 ...