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)

1
vote
1answer
53 views

ERD to Relational schema

I'm new to DBM and I'm trying to learn it online. Honestly, I need some help with this. I don't know if I'm doing this right, and any help will be appreciated. This is my answer for i.
3
votes
2answers
147 views

Difference between an Entity and a Relation

I am currently reading about entities and relations and I can't understand the difference between them? According to Wikipedia we have an example of a relation like in the pic: This looks exactly ...
0
votes
1answer
34 views

Why repetition in join queries

Very dumb question, but bear with me, I am learning and am interested in the principles behind. So: I have a users table and a pages table. In this case, 1 user and 4 pages. If I join the two ...
2
votes
1answer
129 views

What would be the Candidate key (s) of this relation?

R(ABCDEPG) F={AB->CD, DE->P, C->E, P->C, B->G} To my consideration, the candidate keys are: AB, AG, CD, DE. Am I correct? Why or why not?
5
votes
2answers
538 views

Relation between first name and last name

I have some troubles understanding the relation between the a person's First name and Last name in a table. (In a Relational Model) I've read that the relation is of type: 1-1: They are linked ...
3
votes
1answer
139 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
30 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
21 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
86 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
42 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
242 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 ...
4
votes
2answers
193 views

Best data modelling approach to handle redundant foreign keys in relational model

I am looking for advice on the best relational modelling 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
87 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
90 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
119 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
48 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
51 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
86 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
28 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
39 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
48 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
129 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
115 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 ...
6
votes
3answers
277 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
78 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
84 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
36 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
149 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
38 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
139 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
204 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
120 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
55 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
67 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
65 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
98 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
44 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
178 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} ...