Questions tagged [relations]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
17 views

Should I use Postgres' JSON columns for additional related data of different types and not yet known?

I have a simple database table, lets call it tbl_main with a few columns and relations to other tables via foreign keys. The tbl_main is the most frequently written to table, as in it receives new ...
0
votes
0answers
12 views

What is the best relationship for a pair of tables that have optional dependencies but aren't really related?

I have two tables inspections and tasks. The inspection is allowed to have a single task but not many. Inspections don't need tasks and really there is no direct relationship. However, I have a link ...
1
vote
1answer
19 views

Understanding linking tables in a many-to-many relationship

I am still working on a photo storage app (designing the database for the data for the photos stored), using MySQL, and have been told that a photo may have one or more people in it, and a person may ...
-1
votes
0answers
17 views

Database ER Diagrams Relationships

I'm having trouble understanding this ER model: From what I understand: A student enrolls in many classes (therefore a one to many relationship) Many enrollments go into the class registration? (I'm ...
0
votes
0answers
20 views

Constructing relational model from ER

I'm given the following ER model. It's unclear to me how I'd identify copies. For the image entity I think it's sufficient to take the 'ArtistName' and 'ImageName' as a combined primary key. Another ...
0
votes
0answers
11 views

Table realtion vs no relation for ecommerce apps that has huge request

I'm trying to develop ecommerce apps, with flutter for frontend, nodejs as RestAPI, and MySQL for database. I'm trying to develop the cart module. I've 2 options for the database modeling. Cart table ...
1
vote
1answer
53 views

How to filter multiple many to many relationship based on multiple tags?

I've a scheme of two main tables: problem and tag and a relation (which is a many to many connector) table: problem_tags which excerpt of them is like: Problem table: ----+---------------------------...
1
vote
3answers
51 views

Putting foreign keys of several tables into the same column

I've never come across this situation, not sure how to go about it. Let's say I have a table Portfolio. I also have two tables: Asset 1, and Asset 2. I need to create a bridge between Portfolio and ...
0
votes
0answers
24 views

Question about Ternary Entity Relationship Model

I can't wrap my head around these claims concerning this Ternary ER Model. Unfortunately this is in German so here are the translations: Prüfer = Examiner prüft = examines Fach = Subject Datum = ...
1
vote
2answers
117 views

Modeling a three-way association with optional relation

Business rules I have three tables (Parties, Categories and Products) which representing the following relationships: A product is classified by zero-one-to-many categories A category classifies ...
0
votes
0answers
17 views

How do I restrict relations between entities to a parent entity?

I have a multi-vendor database for my e-commerce application. Below is a simple interpretation of my table and relation structure. Table: stores store_id (PK, AutoIncrement) Table: categories ...
0
votes
1answer
41 views

Get data from different tables indexed by same ID

Database: postgresql 12. I have a table people: person_id | name ----------+----- 1 |John 2 |Paul 3 |Jim ... Each person can have zero or more car insurance contracts, so I ...
0
votes
2answers
53 views

Designing One-To-One Relationships

To begin with, I have to admit that I don't have great experience in designing database schemas. Being influenced by OOP , I find that by dividing the info we have about a object into different ...
1
vote
1answer
84 views

Need Help With BCNF Decomposition Problem

I'll try and keep it as quick and concise as I can: I'm currently a novice developer who's super eager to learn Database Normalization and Optimization so I can up my skill in Full-Stack development, ...
1
vote
1answer
30 views

Should pivot tables have more columns (many to many relationship)

I'm currently thinking about how to organize my tables, and I have some information that I'm not sure were should be, one of them is the quantity of a food in a refrigerator Is it right if I add ...
0
votes
0answers
27 views

Relationships overview with some many-to-many

Good morning/afternoon, I am currently beginning a new project and I wanted to design the database before doing anything however I struggle a lot with this design because it has some many-to-many ...
1
vote
2answers
83 views

Unrelated tables and time intervals

I am going to comment on the scenario that I currently have when designing my database. I have the following tables: user (id, name, lastname) role (id, name) user_role (user_id, role_id, ...
0
votes
0answers
29 views

Handling self-relations and composition

I have a table that represent logic rules. A rule has one left component, a logical operator and a right component. For example: (Comp1 AND Comp2) This component can be a "calculation" involving a ...
0
votes
0answers
47 views

Relational Algebra - Remove duplicate tuples without count

I was wondering if there is a way to remove the tuples from a table using relational algebra that have the same Value occurring in multiple columns or same column multiple times e.g. I want to ...
0
votes
0answers
32 views

Delete duplicate keys with relation algebra without count

Hi I am new to relational algebra. I was wondering if there is a way to remove the tuples from a table using relational algebra that have the same Value occurring in multiple columns or same column ...
0
votes
0answers
96 views

Proof Full Outer Join associative and Commutative

I'm trying to prove to myself that the order of full outer joins doesn't matter, but, in an abstract sense, I'm coming up with nothing. How would one go about proving that the order of a set of FULL ...
-1
votes
1answer
20 views

Structure to represent matches between teams or individuals

Say there's a sport that can either be contested between two individuals, or two teams comprised of several individuals. So obviously we need the standard players, teams and teams_players tables. But ...
0
votes
1answer
45 views

Database model / design best practice

I'm looking for a some guidance/advice on how to best model my data. Some background: I have location information that I'm trying to model. There are two categories of locations (company and non-...
0
votes
1answer
79 views

See direct (instead of indirect) info about rented book in my “actors_directors” talbe dropdown list - Access365

I'm building a database of "actors_directors" who are renting "books" from my library - a kind of exercise to learn database basics :-) This is how my "actors_directors" table looks like. They are ...
4
votes
0answers
88 views

Are these tables in 3NF? [closed]

Update: I updated the question to be more specific and also updated the diagram. I am currently in my last semester, I did use SQL before then I left for MongoDB but the practice project requires to ...
1
vote
1answer
40 views

Entity Relationship Diagram - Entity depending on attribute

I have an ER-Diagram containing the entity employees. When employees have high skills they may supervise lower skilled employees. How can I model that in an ER-Diagram? My initial approach of was to ...
0
votes
0answers
50 views

MONGODB -> Whats the best DB model for friendship user Relationship

Good morning: I want to implement friendship between two users, that friendship is defined by a status (accepted, pending, blocked). It only occurs to me to use a collection as follows: USER1 - USER2 ...
0
votes
3answers
67 views

Given a table containing class and students, need to find the diff in students

I have class_students table where given 2 class ids I need to find the diff in students. This is sql fiddle that I used, http://sqlfiddle.com/#!9/dba48e/11 Any help here.
0
votes
1answer
19 views

three tables relation order is correct but values are false

i have those tables table1 | id | name | | 1 | axe | | 2 | bow | | 3 | car | | 4 | dart | table2 table3 | t1_id | ...
0
votes
1answer
91 views

Database design for Scavenger Hunt Game

I'm designing a section of my database which links User, Team and Hunt. I would like users to be members of a team but the team can play multiple hunts (so can be used multiple times). The first idea ...
1
vote
0answers
308 views

Is a relation with two attributes always in Boyce-Codd Normal Form (BCNF)?

I went through some tutorials on BCNF and got that a relation with two attributes is always in BCNF. My question What if a relation with two attributes has no prime or non-prime attributes? That is, ...
2
votes
0answers
62 views

A multiple choice question, with multiple or only one correct answer, and sometimes no correct answer [closed]

It's a question & answer based model, and here is the scenario: A question with multiple choices given, with 3 to 7 correct answers among those choices. A question with multiple choices given, ...
1
vote
2answers
197 views

Are Cataloge and relation cache in PostgreSQL per connection or global to the server?

I am trying to figure out if Postgres' relation and catalog cache are per connection or per server? I did find that plan caches are per connection. It would make sense for the cache to exist for as ...
1
vote
0answers
32 views

Database pattern with two types of owners for an object. Like how users and groups can make posts in FB [duplicate]

Please help. There is a problem I have tried to resolve for some time now. I want to come up with a pattern where i have a table with advertisements on a web platform. These advertisements shall be ...
0
votes
1answer
117 views

Table Relationships for Property Bags Configuration

I am creating a database table setup for user preferences in my application based partially on this design and while I created the tables and foreign keys, I can't seem to figure out the relationships ...
0
votes
1answer
583 views

Is it good practice to create a separate table for views count?

I have created a blog table where I'm having a field called views_count but I have heard that updating the views_count field on each page view is strain. So I have created now a seperate table for ...
-1
votes
1answer
25 views

Creating blog fresh tables from old tables [closed]

I am re-creating a database structure from old tables. New tables should be optimized and easy to understand. In old database the developer used video table name for storing video blogs. However I ...
2
votes
1answer
231 views

BCNF decomposition does not prevent insert anomaly?

I am in the process of designing a schema for a simple polling app and have tried to normalize it with the decomposition algorithm from this lecture. Requirements A poll has a unique id (poll_id), a ...
0
votes
1answer
45 views

Recursive Relationship [closed]

I have an application, which contains two Models Question and Option Each Question has many Options Each Option may have many Questions (and this Question may have many sub Options) so on and so ...
0
votes
1answer
54 views

mysql join many to one table and display each 'many' record as an additional column

I have a many to one table. For example: user_id, name 1, chris 2, john and user_id, item 1, apple, 1, banana, 2, orange How could I run a query that returns something like this: user_id, ...
1
vote
0answers
65 views

Normalizing a relation schema with 'abstract' attribute names

I'm a student currently attending a database design course and I'm having some issues normalizing 'abstract' attribute relation schemas from 1NF all the way to 3NF. When we used examples with '...
1
vote
1answer
89 views

LOB in frequently queried table or separate table

I have a table named FinTrans in an Microsoft SQL Server 2012 server with approx 10K-30K records at any given time and about 2K records are inserted and deleted each day. The table has 3 nvarchar(...
3
votes
2answers
317 views

Is the inverse of Armstrong's Axioms valid as well?

I have been looking into Armstrong's axioms a little bit. In a homework[1] exercise I was asked to prove A→G is in F-closure. I managed to get it at this point: AB → GB Being at this point, can I ...
0
votes
1answer
37 views

Show multiple joined rows

I have a simple relational MySQL database with users, cars an a log table. Everything works fine. In the log table I want to 'register' the users of a car. But a car can have two users at the same ...
5
votes
3answers
77 views

Constraining data based on related data in a different table. Should this be done on the database level or the application level?

I am working on a database that contains our customer information as well as information about our vendors. Part of that includes matching our customers with our vendors, the account numbers those ...
1
vote
1answer
765 views

Circular dependency between 2 table with one to one and one to many relationship

I have 2 tables in SQL database, User and Company. User belongs to one company. So user table has UserID & CompanyID (foreign key) Company can have multiple users. One of them will be the ...
1
vote
1answer
134 views

Table with relation to two others (three-way relation?)

I stumbled across a weird situation that one table has relation to two others but record in it can only have a relation to one of the tables. To clarify things, I have tables: attribute, visit, ...
1
vote
1answer
137 views

Difference of sets with different amount of columns?

Problem When there exists two sets, R and S, and we take the difference R - S, we remove the elements from R that exist in S. For cases where the number of columns are the same on both sides, such ...
42
votes
2answers
9k views

Is it a bad practice to have several mutually exclusive one-to-one relationships?

Say, a table car has one-to-one relationship to tables electric_car, gas_car, and hybrid_car. If a car is electric_car, it can no longer appear in gas_car or a hybrid_car, etc. Is there anything ...
3
votes
1answer
1k views

What is the definition of bad circular dependency?

I have been searching for while for a good resource, where the circular dependency is well explained, unfortunately nothing good found. Therefore I tried to understand exactly which kind of circular ...