On this site this tag applies to questions about Relational Model theory. The Relational Model for database management is an approach to managing data using a structure and language consistent with first-order predicate logic. In the Relational Model of a database, all data is represented in terms ...

learn more… | top users | synonyms (1)

3
votes
1answer
135 views

IS-A relationship with only single sub entity

Hi I'm trying to design a database for a dictionary. The words has several fields like meaning, an example, and maybe a picture. but the words that are 'verbs' has three more special fields that the ...
1
vote
1answer
29 views

Collection of different types of data in a relational database

Let's say I have a table Cars (with columns such as model, make, year, etc.), a table Books (with columns such as name, author, ISBN, etc.) and a table Wines (with columns such as name, appellation, ...
0
votes
1answer
20 views

How to find functional dependancies from a relational schema?

If only given a schema (table header, with primary key indicated), how do i find functional dependancies? My problem is that would not functional dependancies depend on the data stored int he table, ...
0
votes
0answers
12 views

Schema of equijoin in relational algebra

Why does equijoin return a schema consisting of all attributes from both relations (including intersection) when equality between them have already been established? That is, we know that for any ...
2
votes
1answer
81 views

How to maintain Database audits?

I am using MySQL database (with Django ORM). I want to maintain the database audits similar to StackOverflow, Quora, Wikipedia, etc. These websites maintain the revisions of the changes in the ...
0
votes
0answers
40 views

How to map this ER model to actual tables?

Suppose we have an ER-design problem like this: A pharmaceutical company sells its products throughout a country. For the ease of sales, the entire country is divided into some Areas. Areas have ...
2
votes
2answers
54 views

Understanding relations

Since english is not my first language i find hard to understand this paragraph that i'm reading from "Database Fundamentals" book. I'm trying to figure out, in practice, real world, what this ...
2
votes
2answers
220 views

Relational Design - One table, two foreign keys or Two tables, one foreign key each

Looking for some advice related to optimal design in the following scenario. There is a Cases table (represents cases of inventory) There is a LocationInventory table (represents locations with ...
2
votes
2answers
149 views

Best data modeling approch to handle redundant foreign keys in relational model

I am looking for advice on the best relational modeling approach to store surveys, questions, and responses. I am looking for which of the two approaches below looks best, or an alternative approach ...
-1
votes
1answer
24 views

Basic relational algebra question

I'm new to this and have been given a database. I've been asked to write a Basic relational algebra formula which collects failed test results with a certain teacher and display the surname and code ...
0
votes
1answer
77 views

Two ways to define may-have-a (1..0-1) relationship

Today I have discovered for myself that may-have-a (1-0..1) relation can be implemented in two different ways. Let A be the "main" table (left side of ..) and B be the "linked" table (right side of ...
0
votes
0answers
77 views

Finding the closure and super keys of a schema?

I am working on a problem in which I have to look at the relation R with schema R(w, x, y, z), and the three functional dependencies: w -> z ; x,y -> w ;z -> y For every non-empty subset X of ...
4
votes
2answers
109 views

Best practice regarding concurrency for INSERT into a table with composite primary key?

Say I've got the tables users, teams and a teams_users junction table (team_ID, user_ID / composite PK). If I wanted to add a user to a team, what's the best option when it comes to performance / ...
0
votes
1answer
41 views

Storing shipping details in orders table

Have orders table and among columns the following: shipping type, shipping service provider, delivery type and shipping address. Let me explain what these are. User can choose between two shipping ...
1
vote
0answers
31 views

Relational Model

I would really appreciate if you could check my answer for a relational model question. I just started learning. So please bear with me and please guide me through the right process. Consider the ...
0
votes
1answer
49 views

Help with removing duplicate reversed pairs in relational algebra

I have a listing of data that contains duplicate reversed pairs and I need to remove them.. Call them, name1 and name2. Where I have Tom and Mike, and Mike and Tom, such that this single pair is being ...
1
vote
2answers
84 views

Is my db too big for my server? Should I go nosql or stick with relational db management? [closed]

I have a mysql database that is about 22GB in size and has multiple tables with hundreds of thousands of records, my biggest table has 1.8 million records. The Database was not professionally designed ...
0
votes
0answers
26 views

Calendar mult-data mult-request relations model

I have a table "USERS" I have a table "HOUSES" I have a table "CALENDAR" I have a table "TRANSACTIONS" I need build a schedule(CALENDAR) that relates to every home, every home has days available for ...
1
vote
1answer
36 views

Transaction Table in Personal Finance App

I'm a noob designing a Personal Finance App to teach myself Rails. This is just for learning purposes, but I actually intend to use it to replace my current system in Google Spreadsheets. I want to ...
0
votes
0answers
18 views

Database relation

Let's say I have 2 tables: A and B in relation one-to-one. CREATE DATABASE test; USE test; CREATE TABLE A ( a1 int, a2 int, Ab1 int, -- optional foreign key PRIMARY KEY(a1) ); CREATE TABLE B ( b1 ...
0
votes
1answer
45 views

How to create a one to one relationship

DROP DATABASE if exists test; CREATE DATABASE test; USE test; CREATE TABLE A( a1 int not null, a2 int, PRIMARY KEY (a1) ); CREATE TABLE B( b1 int not null, b2 int, PRIMARY KEY (b1) ); How can I ...
2
votes
1answer
124 views

Table to create Ids for one table to many table relationships

I have several tables that will represent an object that can be commented on. I would like to store all the comments in one table. To relate the other tables to the comments, I was thinking of adding ...
0
votes
1answer
111 views

How can I re-structure my activities table?

I've created a feed but I'm not sure whether it's okay or not, hopefully will get some answers to correct it if there's anything wrong. I'm using MySQL. When a user does something, his activity is ...
0
votes
1answer
40 views

Tuple calculus: unsure if my reasoning is correct

I'm currently working through a tuple calculus question and I ran into a situation where I have two answers that seem correct to me and I am unsure if my logic is wrong or if they are both correct ...
5
votes
3answers
228 views

If a table with a surrogate key has a column known to have unique non null values (eg SSN), does it violate 3NF?

As I understand it, third normal form (3NF) basically means there should be exactly one key. If a table with say an auto-increment id column also has a column known to be unique and not null, eg ...
0
votes
2answers
74 views

Making database tables 1NF

I am creating a database for a DVD rental shop, I have various entities that are related to this question, such as Film, FilmStar. For each film, you record its unique number, title, the year in ...
0
votes
1answer
83 views

Select all from A where attribute exists in B [closed]

I have a question involving relational algebra. Suppose I have two relations A and B, where B has a foreign key that references A. Using relational algebra, how do I select all tuples from A where ...
0
votes
1answer
35 views

Attributes in relation after cross product

I have a question regarding the resulting attributes in the cross product of two relations in relational algebra... Generally, the cross product will result in a relation whose attributes is the sum ...
3
votes
3answers
143 views

Primary key in resulting relation from union operation in relational algebra

I have a question regarding the resulting table/relation from a union operation in relational algebra. Does the resulting relation not have a primary key? Or does it return a table with a hidden ...
3
votes
1answer
85 views

How to remove unreferenced rows in a “Many to One” relation?

in my db i have the following entities: Cities, Persons, Houses. Each Person MUST live in a City. Each Person CAN live in a House. Each Person can change or leave their Houses. Persons living in ...
1
vote
0answers
36 views

Do relational databases typically understand '1' and '0' as booleans?

I'm working on a code library that helps users build database searches from form inputs (a layer on top of an ORM). I want it to be compatible with most relational databases. I currently have a ...
7
votes
2answers
136 views

What are the practical uses for relational calculus?

In my Database Design course we are learning both Relational Algebra and Relational Calculus. I can see where Relational Algebra could be useful since it is closely tied to SQL. Our professor said ...
1
vote
1answer
73 views

1NF vs BCNF cons and pros [closed]

I have a clue what 1NF and BCNF are, but I wonder why should someone prefer 1NF instead of BCNF? What are cons and pros with having relation in 1NF and BCNF?
10
votes
6answers
1k views

Explaining 2NF vs 3NF with an example

I have a problem with second normal form (2NF) and I have been unable to solve it by using Google. It is making me crazy because I am a teacher and I don't want to teach wrong stuff to my students. ...
1
vote
1answer
69 views

Converting table to a 2NF relation

I'm currently going through the process of learning about database normalization & having a crack at creating my first relational database. It was going well until I hit the following problem. ...
3
votes
2answers
174 views

Many-to-many relationship when one entity is without attributes

I'm interesting in mapping many-to-many relationship to relational model. I understand that the basic approach is to create a third table (associative entity) that connects the entities in ...
1
vote
0answers
85 views

Sql query , please check whether my solution is correct?

Problem is: Consider the following relational schema: COURSES (cno, cname) STUDENTS (rollno, sname, age, year) REGISTERED FOR (cno, rollno) The bold attributed indicate the primary keys for ...
2
votes
1answer
106 views

One to many relationship on a junction table

I have two entity's - Workout and Exercise. These will have a 'many to many' relationship through the junction table WorkoutExercise. Things start to get complicated when I need to have a 'one to ...
0
votes
1answer
50 views

I have a database design for an E-commerce website. Need to know how to display related product for each specific product

For example: A customer is viewing a product on the website, say a laptop. There's a section on the left where i need to display products from the database that are associated with this particular ...
4
votes
1answer
145 views

UPDATED: Relational (or NoSQL) Database Design

(Updated this question with more specifics. Decided on a Relational Database, and would love some comments on its design) This database holds assembly instructions data for shipbuilding, later use in ...
1
vote
1answer
63 views

Adding restaurants in database

I wanna store some vendors (like McDonald ,etc) and it's branches in a table. a vendor may,or may not have branches. I have created two tables: 1- A vendors table which have name,logo, etc. 2-A ...
0
votes
3answers
64 views

How to design a Table in which its fields varies on its categories?

I am trying to design a database to post free ads. Eg http://www.gumtree.com.au/p-post-ad.html Scenario: Every ad will have different categories and some categories will have further sub categories. ...
0
votes
0answers
97 views

Method to economically insert Bill of Materials BOM items into a Stock Table?

I’m new to the wonderful world of database design and I’m currently experimenting with an implementation for my little brother relating to Model Train Sets. [I will be using SQL Server 2012 / Asp.Net ...
1
vote
1answer
42 views

Is this the correct way to model a relationship between an object which may or may not have another object?

I'm creating a database for a department store and the database has two tables: Items and Coupons. An item, like a TV, can only ever have one coupon. Some items don't have a coupon at a given time. ...
5
votes
1answer
149 views

Decomposing a relation into 3NF/BCNF

I am having trouble decomposing a relation to 3NF/BCNF. I have determined that for the relation: R (A,B,C,D,E,F,G,H,I) where: {A -> B,C} {E -> F} {D -> I} {A,D -> G} {G -> H} ...
4
votes
2answers
294 views

What are the practical reasons behind learning relational algebra?

Learning how to formulate query-like expressions in relational algebra is a traditional part of many, perhaps most, "Introduction to Databases" courses. This is usually justified by the assertion ...
2
votes
1answer
77 views

Dynamic relations in MongoDB

I'm designing a document with MongoDB where users have relationships with each other. Easy enough, right? { _id: "012", username: "happy4u", // ... related: [ '123', // user ...
1
vote
1answer
375 views

Missing diagram option SSMS

I would like to create a relationship between to tables. Normally and in previous versions of sql server and the management studio I would go to database diagrams and draw the relation in the diagram. ...
0
votes
1answer
30 views

Updating inverse side bidirectional association

I understand (more or less) the concept of unidirectional and bidirectional association in a relationship, but I don't see the correct practical application of it. For example, I want an contact ...
1
vote
3answers
90 views

Table with relationship to multiple tables

I want to persist contact details for persons. This contact details can belong to a client, or a next of kin member, or whatever other entity. I'll be using Doctrine2 in a Symfony project, that will ...