Questions tagged [junction-table]

A junction table is a table that contains common fields from two or more tables and is the canonical way to implement Many-to-Many relations in SQL and Relational-type databases.

In database management systems following the relational model, a junction table is a table that contains common fields from two or more tables. It is on the many side of a one-to-many relationship with each of the other tables. Junction tables are known under many names such as bridge table and linking table.

221 questions
0
votes
2 answers

How to show junction table in a matrix with WPF?

I have two enums: public enum MyEnumA { OptionA1 = 1, OptionA2 = 2, OptionA3 = 3, } public enum MyEnumB { OptionB1 = 1, OptionB2 = 2, OptionB3 = 3, } and a class containing both enums public class AB { public MyEnumA A…
ffonz
  • 1,304
  • 1
  • 11
  • 29
0
votes
2 answers

Merge rows from cross referenced tables

I'd like to create a SQL Server select statement where the cross referenced data are in one column from different rows. I'd like to use stuff (if possible) and no ;with command. Contract table ID Subject 1 a 2 b 3 c Company table ID Name 1 …
Satu
  • 25
  • 2
  • 8
0
votes
1 answer

sqlalchemy: remove item from a junction table

I have a junction table which holds references to other two tables. What I want is to remove this refrence from the junction table. In the junction we can have more then one item from a geven type for one plane. The problem is that when I remove a…
bozhidarc
  • 834
  • 1
  • 11
  • 25
0
votes
0 answers

Hibernate junction table POJO foreign keys inside objects

For example, i have 3 tables: Man: int pk_id Junction: int fk_m_id, int fk_w_id, String some_info Object Man, Object Woman Woman: int pk_id The junction table has Man and Woman's foreign keys as attributes, but it also has Man and Woman objects…
user663381
-1
votes
1 answer

Should I include a junction table with a primary key in my ski rental database schema?

I need to make the ER diagram and the relational schema of the Ski rentals. I have an Customer, Rental and Ski as a entities as well as their attributes. Customers and Rentals should have the one-to-many relationship and the relationship between…
-1
votes
1 answer

junction tables / many to many relationships

I am using sql server to create a database and I have many to many relationships and I am wondering if it is a good idea to connect all of them in one junction table or I must create a junction for only two tables. I have 5 tables that are many to…
-1
votes
2 answers

Query M:N contains

I am trying to filter a set of tables that includes an M:N junction table in Android Room (SQLite). An image can have many subjects. I'd like to allow filtering by a subject, so that I get a row with complete image information (including all…
Anthony
  • 7,638
  • 3
  • 38
  • 71
-1
votes
2 answers

Select rows which has multiple values in junction table

I have three tables: posts (id, content) posts_tags (posts_id, tags_id) tags (id, tag) How do I select all posts that have (at least) 2 specific tags (lets say tags with id 1 and 2)? For example, posts table: id content ---- ------- 1 …
schoel
  • 793
  • 1
  • 6
  • 14
-2
votes
1 answer

ms access: create 1-m relationship from junction table to other table

I have two tables, tblRecipes and tblChemicals, that are linked in a many to many relationship using a junction table tblRecipesChemicalsLink. I have a bunch of variables for calculations that differ between the same ingredient used in a different…
-2
votes
1 answer

Appropriate table schema for multiple many-to-many relationship and concerns about uniqueness

I am trying to create a simple database to store various job listings. For the purpose of this question let's say I have 5 distinct job offers: ╔══════════════════╦═════════════════╦═════════════════════════╗ ║ title ║ level ║ …
-4
votes
1 answer

Junction table vs. many columns vs. arrays in PostgreSQL: Memory and performance

I'm building a Postgres database for a product search (up to 3 million products) with large groups of similar data for each product, e.g. the prices for different countries, and country-specific average ratings, with up to 170 countries. The natural…
1 2 3
14
15