Questions tagged [relational-database]

A relational database is a database consisting of relation variables (which are also called *relvars*, *R-tables* or just *tables*). The definition, manipulation and integrity rules of relational databases are based on relational operations equivalent to or similar to the Relational Algebra and Calculus. Relational database principles are the basis of a substantial part of data management theory and practice.

A relational database is a database consisting of relation variables (which are also called relvars, R-tables or just tables). The definition, manipulation and integrity rules of relational databases are based on relational operations equivalent to or similar to the Relational Algebra and Calculus. Relational database principles are the basis of a substantial part of data management theory and practice.

Targeted Questions

This tag is appropriate for questions concerning the relational model, relational and relational database implementation.

The SQL language is commonly used to specify relational database-designs and to define and solve relational database problems. However, DBMSs based on SQL are by definition not s and therefore not all SQL questions are relevant to the relational database tag. Questions specific to or its implementations should be tagged accordingly.

6790 questions
147
votes
8 answers

Use cases for NoSQL

NoSQL has been getting a lot of attention in our industry recently. I'm really interested in what peoples thoughts are on the best use-cases for its use over relational database storage. What should trigger a developer into thinking that particular…
robjmills
  • 18,438
  • 15
  • 77
  • 121
125
votes
9 answers

Why use multiple columns as primary keys (composite primary key)

This example is taken from w3schools. CREATE TABLE Persons ( P_Id int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Address varchar(255), City varchar(255), CONSTRAINT pk_PersonID PRIMARY KEY…
125
votes
14 answers

When I should use one to one relationship?

Sorry for that noob question but is there any real needs to use one-to-one relationship with tables in your database? You can implement all necessary fields inside one table. Even if data becomes very large you can enumerate column names that you…
Pavel Shchegolevatykh
  • 2,568
  • 5
  • 29
  • 32
123
votes
8 answers

Comparison of Relational Databases and Graph Databases

Can someone explain to me the advantages and disadvantages for a relation database such as MySQL compared to a graph database such as Neo4j? In SQL you have multiple tables with various ids linking them. Then you have to join to connect the tables.…
user782220
  • 10,677
  • 21
  • 72
  • 135
118
votes
9 answers

What are the uses for Cross Join?

A cross join performs a cartesian product on the tuples of the two sets. SELECT * FROM Table1 CROSS JOIN Table2 Which circumstances render such an SQL operation particularly useful?
Llyle
  • 5,980
  • 6
  • 39
  • 56
114
votes
8 answers

How to create relationships in MySQL

In class, we are all 'studying' databases, and everyone is using Access. Bored with this, I am trying to do what the rest of the class is doing, but with raw SQL commands with MySQL instead of using Access. I have managed to create databases and…
Josh Hunt
  • 14,225
  • 26
  • 79
  • 98
111
votes
7 answers

Difference between a theta join, equijoin and natural join

I'm having trouble understanding relational algebra when it comes to theta joins, equijoins and natural joins. Could someone please help me better understand it? If I use the = sign on a theta join is it exactly the same as just using a natural…
maclunian
  • 7,893
  • 10
  • 37
  • 45
97
votes
26 answers

How do you like your primary keys?

In a fairly animated discussion in my team I was made to think what most people like as primary keys. We had the following groups- Int/ BigInt which autoincrement are good enough primary keys. There should be at least 3 columns that make up the…
92
votes
1 answer

Modeling Product Variants

I've been trying to model product variants and thought that I might need to use EAV. I might have been able to do it without EAV, but I'm concerned that I might have missed something. Here's my design: Here's what I am trying to represent: A…
85
votes
8 answers

What is the difference between a Relational and Non-Relational Database?

MySQL, PostgreSQL and MS SQL Server are relational database systems, and NoSQL, MongoDB, etc. are non-relational DBMSs. What are the differences between the two types of system?
marcamillion
  • 32,933
  • 55
  • 189
  • 380
83
votes
8 answers

Still Confused About Identifying vs. Non-Identifying Relationships

So, I've been reading up on identifying vs. non-identifying relationships in my database design, and a number of the answers on SO seem contradicting to me. Here are the two questions I am looking at: What's the Difference Between Identifying and…
JasCav
  • 34,458
  • 20
  • 113
  • 170
81
votes
6 answers

Composite Primary Keys : Good or Bad?

Although one can use composite primary keys, for the case below, is it really a bad practice? The consensus on Stackoveflow seems to go both ways on this issue. Why? I want to store payments for the orders in a separate table. The reason is that,…
JAX
  • 1,540
  • 3
  • 15
  • 32
80
votes
6 answers

Pros/cons of document-based databases vs. relational databases

I've been trying to see if I can accomplish some requirements with a document based database, in this case CouchDB. Two generic requirements: CRUD of entities with some fields which have unique index on it ecommerce web app like eBay (better…
user2427
  • 7,842
  • 19
  • 61
  • 71
73
votes
7 answers

When shouldn't you use a relational database?

Apart from the google/bigtable scenario, when shouldn't you use a relational database? Why not, and what should you use? (did you learn 'the hard way'?)
Stephen
  • 1,215
  • 2
  • 25
  • 40
70
votes
3 answers

Practical example for each type of database (real cases)

There are several types of database for different purposes, however normally MySQL is used to everything, because is the most well know Database. Just to give an example in my company an application of big data has a MySQL database at an initial…
daniel__
  • 11,633
  • 15
  • 64
  • 91