1
vote
2answers
33 views

How to insert values into a table from two different tables?

I have three tables students table ------------------------------------ id(PK, A_I) | student_name | nationality teachers table ------------------------------------ id(PK, A_I) | teacher_name ...
0
votes
2answers
108 views

Parent/child relationship or not if the name of the field implies the relationship?

I am working with the harmonized system and try to catalog this in a MySQL database. This works for example like this: 01 LIVE ANIMALS 0101 horses, asses, mules and hinnies, live 0102 bovine ...
0
votes
0answers
8 views

MySQL Associative Weak Entity

I'm working on a project in MySQL that has a table of users who have favorite foods. Favorites is an associative entity between Users and Foods. I want the Favorites table to be a week entity of the ...
1
vote
1answer
26 views

Understanding how relationship sides works

So, I have this relations on my tables (see image) and I need to understand some things. I'll enumerate what I understand and what I need from yours is to say if I'm right or not and in case I'm not ...
0
votes
2answers
52 views

Help required to design a database [closed]

Firstly I would like to apologies if this is not the correct place to ask this question but I know how good community spirit is around here from my time in Stack Overflow. I am very new to the world ...
0
votes
0answers
15 views

Would an INNER JOIN query in a sharded relational database hit the same shard when using a compound primary key?

In this question I have asked about modulus calculation in sharded tables, this design is used: CREATE TABLE Orders (order_id INT PRIMARY KEY, ...); CREATE TABLE LineItems (order_id INT, lineitem_id ...
0
votes
1answer
158 views

Cannot add foreign key constraint while creating table

My Error Code is 1215 which finds problem with the foreign key constraint. I know all fields are the same data types. I can't see where the problem is. Any help would be much appreciated! Thanks! ...
0
votes
1answer
51 views

Split MySql table into two tables with One to many Relationship

I have an old database table in MySql. It is used to store the orders from online ecommerce. Simplified diagram looks like this: +----+------+-----------------------+-------+--------------+ | id | ...
1
vote
1answer
47 views

one to one relationship

This is my database structure: Users {user_id, username} Profiles {profile_id, user_id, user_views} My question is: If I do it the way mentioned above, should I to set user_id as primary key or ...
0
votes
1answer
226 views

MySQL Workbench - Creating a one-to-one relationship using existing columns?

How do I create a one-to-one relationship using existing columns in MySQL Workbench? I have an EER diagram tab open and I am selecting from the toolbar on the left hand side. Unfortunately it seems ...
1
vote
0answers
59 views

How to join the tables in mysql to get wall messages and comments with name of person ? Only user and his friends messages

I have four tables in my mysql database as shown in the image url provided. I want to select data from the tables without duplication. I want to show messages and comments on wall according to the ...
0
votes
1answer
26 views

Effectively modelling extended classes

I have 3 different types of content for a website, 'Article', 'Video', 'Review'. Each of those three types of content contain common fields and type specific fields. For this, I have created the ...
0
votes
0answers
98 views

In mySQL possible to change auto-increment ids that have huge gaps and if so how?

I am importing a 50 table relational database (I'm not a dba) with 250,000+ records in most of the tables, yet the auto increment is off in most tables, some for example showing the last ID at 5 ...
0
votes
1answer
256 views

Advantages of middle tables in one-to-many relationships

Entities: Lists Leads What I am trying to achieve is a scenerio where in the relationship between lists and leads the following constraint is applied: A list can have many leads, but a lead can ...
0
votes
2answers
90 views

Multiple relationships issue

Here is my SQLFiddle: http://sqlfiddle.com/#!2/affc4/9 A brief description of the issue: I have the following data: topics brands celebrities All 3 of those data types can be associated to an ...
0
votes
2answers
141 views

Diffrence between relational and unrelational database [closed]

What is the difference between relational(MySql) and unrelational database(MongoDb)
0
votes
0answers
76 views

Need advice on this EER Diagram

This db will work with a CakePhp app and need advice about design. Is it good idea to put orders on center or should I put clients on center? Clients has orders and an order record can only have one ...
1
vote
0answers
58 views

Table Structure: 2 Related Entities Share the Same Entity

I was hoping I could get some advice on my table structure. Im writing a simple workout tracker for me and my buddies. These are the requirements: Multiple users A user can have multiple workouts A ...
0
votes
1answer
229 views

Event Management System

I'm working on a "Event Management System" Online Software Project where the system requires the following: Viewers can sign up for their user account Events can be created by the admin from the ...
2
votes
0answers
386 views

The nature of the relationship between two tables in MySQL

Good day. I'm designing a database for a research project where we're predicting whether or not young female athletes will rupture their ACL(s) based on the nature of a test jump recorded with a ...
1
vote
1answer
431 views

What does a round relationship icon mean in MySQL Workbench Visual Data Model

I have created a model in the Visual Data Model of MySQL Workbench, and on one single relationship, this icon shows up: What does it mean? The Relation is 1:1, and this icon shows only on this ...
2
votes
1answer
28 views

NEWB Getting to KNow New Database and Understand Where Relationships Are

I'm teaching myself SQL using MYSQL and a textbook. While working through the textbook I'm using a database I'm kinda familiar with - an exported copy of my CMS driven websites database. My website ...
1
vote
1answer
30 views

related column contents

I've designed a mysql database made of several independent/unrelated tables to use in my office. Different tables hold information about clients (names, addresses etc), visits to the office (dates, ...
0
votes
1answer
43 views

Bit column vs multiple join tables

I asked a question earlier about how I could define a many to many relationship between users and FOSes (fields of study). My original question was how could we know whether the user was the ...
0
votes
1answer
128 views

Multiple junction tables?

I am working on a system where you have users, and you have Fields of Study or 'fos' for short. Each user can have many fos and each fos can have many users. So we are dealing with a many to many ...
1
vote
1answer
38 views

JOIN to read first table and get possible relationship in the second table

Consider a main table as CREATE TABLE groups ( group_id int(11) NOT NULL AUTO_INCREMENT, group_title varchar(255), PRIMARY KEY(group_id) ) ENGINE=InnoDB and a second table for relationship as ...
0
votes
1answer
85 views

Index optimization

I'm building a 'tag' system for my blog posts. Currently my tags table has columns tagid - MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY and tag VARCHAR(30) NOT NULL UNIQUE. And I have another table ...
1
vote
1answer
146 views

Separating tables vs having one table

At the moment I have a table setup that looks somewhat like this: create table tbl_locationcollections ( id int(11) PRIMARY KEY IDENTITY, --(Primary Key), name varchar(100) not null, ...
1
vote
1answer
250 views

Delete entry from related tables

I can not use InnoDB engine because of some dependency troubles in LuaSQL and PtokaX. My current query is something like: DELETE e.*, m.* FROM entries e INNER JOIN magnets m ON m.eid = ...
2
votes
2answers
229 views

MySQL - Normalization over meaningless data - Compound Primay Keys or Surrogate ID field

Please forgive my title; if you have a suggestion for it, feel free to comment. I have a database: DROP TABLE IF EXISTS `books`; CREATE TABLE `books` ( `isbn` VARCHAR(255) NOT NULL, `title` ...
0
votes
2answers
65 views

View for a MANY_MANY_MANY relationship

Let's say I have 3 main tables: category, tag, url category and tag have a MANY_MANY relationship (category_tag). tag and url have a MANY_MANY relationship (url_tag). I would like for a given ...
1
vote
2answers
5k views

MySQL Workbench, how to refresh EER diagram?

I'm using MySQL Workbench to design my MySQL database and model how entities would look like and how they would relate to each other. Now, sometimes I use Doctrine ORM. When using Doctrine ORM, I ...
6
votes
1answer
395 views

Friends relations in MySQL

I'm developing a friendship relation in MySQL where friend relation is mutual. If A is friend of B, then B is friend of A. If one of the users end friendship then relation drops. I want to learn which ...
1
vote
1answer
44 views

What is this type of query called, and how can I formulate it?

I have following tables: events(event_id, name, description) groups(group_id, event_id, title, description) event_group(event_id, group_id) users(user_id, name, email) ...
2
votes
2answers
199 views

mySQL Relational Tables

Say I have 3 tables Products, Orders and Orders Product Products Table ID | StockNum | Description | Price 4 | 452SB | Black | 45.65 5 | 752SA | Green | 17.12 Orders Table ID ...
6
votes
2answers
2k views

Is one-to-one relationship normalized?

Consider we have a large set of statistical data for a record; e.g. 20-30 INT columns. Is it better to keep the entire set in one table as they all belong to a record OR creating a another table ...
15
votes
4answers
7k views

How should I design a relationship table for friendship?

If A is a friend of B, then should I store both values AB and BA, or one is enough? What are the advantages and disadvantages of both methods. Here is my observation: If I keep both then I have to ...
4
votes
3answers
236 views

How to design this simple DB?

How to design this simple DB? I need to add some things to a DB I use to keep track of servers. Table looks something like this. Matrix | Name | Description | Etc | Etc | ...
2
votes
1answer
160 views

How can I best combine “get categories” and “has user access”?

I was wondering if it's possible to create a query for the following problem. I only want to select categories from the (MySQL) database (if the user has access). A user has multiple roles; A ...
0
votes
1answer
853 views

Entity Relationship Model for linked tables

Certainly a noobish question, but I'll ask it anyway. Perhaps someone else will be thankful. ^^ I am getting warmed up with MySQL and I try to understand the concepts of creating well structured ...
1
vote
0answers
442 views

Which database technology for big structured data? [closed]

Scenario: Think you have got 100TB of text in 200 tables. This is structured related data. compareable to dbpedia only more data. Any really relational and distributed and performant database would do ...