Questions tagged [relations]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
12 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
4answers
37 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
17 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
34 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 ...
0
votes
0answers
12 views

Database design for arrays - utilize relational database

I am trying to build an application, where users can create unlimited "parsing fields", that will contain either a: String Array id | name | type ------------------- 1 | name | string 2 | table |...
1
vote
0answers
47 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
43 views

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

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, ...
0
votes
2answers
67 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
31 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
35 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
148 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
22 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
178 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
43 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
41 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
59 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
70 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
193 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
74 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
437 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
84 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
51 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 ...
38
votes
2answers
8k 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
666 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 ...
0
votes
1answer
56 views

One to Many Relationship: Describing the Tables

If we have two tables in a One-to-Many relation ship, is there a standard name to properly refer to the tables? For example if I have a table of books, and a table of authors (ignoring for now the ...
1
vote
0answers
126 views

DBMS Query Preprocessor Checks Semantics or Syntax?

I encountered the following statement when reading about the constituents of a query processor in a DBMS: ... (b) A query preprocessor, which performs semantic checks on the query (e.g., making ...
0
votes
3answers
1k views

Return “parent” rows where only one “child” record exists in one-to-many relationship

Having a one-to-many relation, I am trying to get records in the accounts table where only one record exists in the accounts_prop table. I have the following query, but it does not do the desired. ...
2
votes
1answer
377 views

Database relationship inheritance [closed]

I have a vehicle sales store. In my store I sale many kind of vehicles for example cars and boats. And I would like to keep track of the sales. My vehicles has some attributes as: Arrive on store ...
2
votes
1answer
394 views

Mysqldump subset of database with relational data using a master table

I have found a lot of articles describing the concept of exporting and importing relational data, but I have not been able to find any article describing this more generally for a MySQL database, ...
1
vote
2answers
57 views

3 different queries from 2 tables

I have three tables (palettes, boxes, layout) with sample values: Palettes |ID_P|sign| | 1| P1| | 2| P2| | 3| P3| | 4| P4| Boxes |ID_B|sign| | 1| B1| | 2| B2| | 3| B3| | 4| ...
3
votes
0answers
2k views

How do you perform the chase test?

Trying to follow the chase algorithm as I understand it, If two rows agree in the left side of a functional dependency (FD for brevity), make their right sides agree too. Always replace a ...
2
votes
1answer
65 views

Equivalent functional dependencies

I cannot understand why F1 is not equivalent to the other sets of dependencies below given the relation R(A,B,C): F1 = {A → B, B → C} F2 = {A → B, A → C} F3 = {A → B, AB → C} This is question no. 6 ...
2
votes
3answers
673 views

Contacts table with multiple entries?

Here is a part of our Database: Table: Users ID INT First Name VARCHAR Last Name VARCHAR Email Address VARCHAR ... Table: Contacts ID INT User_id INT (Foreign Key)...
1
vote
2answers
2k views

Counting distinct entries in a column using relational algebra

So I have a table similar to this one. Each user has posted a review about one or more hotels(A,B,C,D) but on different dates so there are no duplicate tuples even though a person might have reviewed ...
0
votes
1answer
70 views

MS SQL DB design help

I'm stuck with table design and query FOR XML Sync engine for Ads requires XML schema in this format <attribute1>value</attribute1> <attribute2>value</attribute2>… <...
4
votes
5answers
397 views

What is the best practice for selecting from two tables with multiple relations?

I have two tables with a structure like below: and am selecting the data with below query: SELECT (SELECT Name FROM Management_EnumerableItem ME WHERE ME.ID = DN) DN, (SELECT Name FROM ...
2
votes
1answer
885 views

Proof that Inner Join is Commutative

I'm trying to prove to myself that the order of inner 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 INNER ...
0
votes
1answer
71 views

In a school database, do I need to have repeating data when a student can also be a teacher?

I've seen lots of ERDs of schools, teachers, and all the junction/associative tables. They always have three tables: Teachers Students Associative table betweeen them, maybe subjects of something ...
2
votes
1answer
549 views

Functional dependencies proving method

I was having some difficulties when trying to use Armstrong axiom to solve functional dependencies. R (A,B,C,D,E,F) Given FD = { A->CD , C->BE, B->F, F->A } Prove A-> BF By using ...
0
votes
1answer
41 views

DB architecture: What if a table is part of another table

My SQL Server database has the initial table named Lead. This table has all kinds of info about a lead person. It has 3 foreign key columns: IndustryId, BusinessTypeId and ReferenceId. I have a ...
1
vote
0answers
76 views

Table Relationships: Table 1 (Field 7, Field 8, Field 9) to Table 2 (Field 1)

I'm sure that this is probably 'Databases 101', but I can't seem to figure it out. So, I'm setting up a database in Access - that I will want to move to MySQL, and I currently have 4 tables, set up ...
3
votes
3answers
72 views

Meta-relationships (Relationships between relationships) versus tuples

I am designing a database which needs to store some fairly complex relationships among many different types of entities. In the simplest example, let us say I have three types of entities - "Student",...
0
votes
2answers
64 views

Normalization of a table

I am trying to normalize the following table but having some difficulties Mem_id mem_name phone email Book_num Book_titl Author_nam publication edition 100 smith 12443 eml1 200 physics ...
1
vote
1answer
22k views

Structure a database for a Blog

I built a database for a blog. I am a student yet, so my knowledge is limited in this area. I post this question to get a briefly description of what I do wrong, why, and how I can fix it. I'm not a ...
1
vote
1answer
73 views

Many-many relation with specific type

Sorry if this question has already been asked, but I didn't find it performing a search. I have 2 tables (table_a and table_b), linked by a many/many relation. The relation can be of two types, ...
1
vote
0answers
146 views

Mysql InnoDB relations vanish when exporting/importing to online database

My issue is the following : I have a local database running on EasyPhp server : WEB server : Apache/2.4.7 (Win32) PHP/5.5.8 DB server : 5.6.15-log - MySQL Community Server (GPL) PHPMYADMIN : version ...
2
votes
1answer
1k views

What is the cardinality of entity relationship between Employee and Department?

Recently, a friend of mine asked me this question about the cardinality between a Department and Employee entities, I replied many to many, then he, my friend, showed me drawings from the internet ...
4
votes
1answer
478 views

How can I avoid this circular relation?

I based my account/user table design following this article. So I have set my table relationships to look something like this: User <- Memberhip -> Group -> Account With this design, a user ...
2
votes
1answer
752 views

Conditional relationships? One-to-many relationship using a pivot table for only a type of entity

I have the following tables: users: - id - name - user_type_id (references id on user_types) neighborhoods: - id - name homes: - id - house_number - neighborhood_id (references id ...