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
68
votes
5 answers

Are relational databases a poor fit for Node.js?

Recently I've been playing around with Node.js a little bit. In my particular case I wound up using MongoDB, partly because it made sense for that project because it was very simple, and partly because Mongoose seemed to be an extremely simple way…
Matthew Daly
  • 9,212
  • 2
  • 42
  • 83
67
votes
4 answers

How to persist a graph data structure in a relational database?

I've considered creating a Vertices table and an Edges table but would building graphs in memory and traversing sub-graphs require a large number of lookups? I'd like to avoid excessive database reads. Is there any other way of persisting a graph?…
Frank Flannigan
  • 1,339
  • 3
  • 16
  • 25
66
votes
3 answers

How to organise a many to many relationship in MongoDB

I have two tables/collections; Users and Groups. A user can be a member of any number of groups and a user can also be an owner of any number of groups. In a relational database I'd probably have a third table called UserGroups with a UserID column,…
66
votes
5 answers

Database design for user settings

Which of the following options, if any, is considered best practice when designing a table used to store user settings? (OPTION 1) USER_SETTINGS -Id -Code (example "Email_LimitMax") -Value (example "5") -UserId (OPTION 2) create a new table for…
001
  • 62,807
  • 94
  • 230
  • 350
65
votes
8 answers

How can I find MAX with relational algebra?

Working with databases, how can I find MAX using relational algebra?
Ifiok Idiang
  • 705
  • 1
  • 6
  • 5
65
votes
3 answers

Setting up table relations what do "Cascade", "Set Null" and "Restrict" do?

I want to start using table relations in a new project. After some googling I got 2 tables set up as InnoDB: The keys I want to link are ->users->userid (primary) ->sessions->userid (index) The only thing that I don't understand in this process is…
HTDutchy
  • 1,090
  • 2
  • 13
  • 25
65
votes
10 answers

How should international geographical addresses be stored in a relational database?

Given the task of storing international geographic addresses in a relational table, what is the most flexible schema? Should every part of the address be broken out into their own fields, or should it be more like free text? Is there any sense in…
Bob
  • 97,670
  • 29
  • 122
  • 130
62
votes
5 answers

Database design: 3 types of users, separate or one table?

I have 3 types of users: Admins Suppliers Employees Each user type will have different user interface and access different types of data. Their only similarity is they are using one web application but they access totally different things. Is it…
IMB
  • 15,163
  • 19
  • 82
  • 140
61
votes
6 answers

What is the difference between MySQL & MySQL2 considering NodeJS

I have read the following: What the difference between mysql and mysql2 gem So far I have only used MongoDB with NodeJS and I want to be able to learn MySQL for any of my relational database needs. While researching MySQL & NodeJS I have found…
Eric Bishard
  • 5,201
  • 7
  • 51
  • 75
56
votes
2 answers

Relational Data Model for Double-Entry Accounting

Assume there is a bank, a large shop, etc, that wants the accounting to be done correctly, for both internal accounts, and keeping track of customer accounts. Rather than implementing that which satisfies the current simple and narrow requirement,…
Alex
  • 972
  • 1
  • 9
  • 16
56
votes
6 answers

When to use MongoDB

I'm writing an application that doesn't necessarily need scaling abilities as it won't be collecting large amounts data at the beginning. (However, if I'm lucky, I could down the road potentially.) I will be running my web server and database on the…
dez
  • 2,195
  • 6
  • 25
  • 29
56
votes
4 answers

What are the known ways to store a tree structure in a relational DB?

There is the "put a FK to your parent" method, i.e. each records points to it's parent. Which is a hard for read actions but very easy to maintain. And then there is a "directory structure key" method: 0001.0000.0000.0000 main branch…
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
55
votes
11 answers

What is the difference between a candidate key and a primary key?

Is it that a primary key is the selected candidate key chosen for a given table?
Celeritas
  • 14,489
  • 36
  • 113
  • 194
49
votes
4 answers

How to perform a LEFT JOIN in SQL Server between two SELECT statements?

I have two SELECT statements in SQL Server like these: (SELECT [UserID] FROM [User]) (SELECT [TailUser], [Weight] FROM [Edge] WHERE [HeadUser] = 5043) I want to perform a LEFT JOIN between these two SELECT statements on [UserID] attribute and…
moorara
  • 3,897
  • 10
  • 47
  • 60
48
votes
6 answers

When to use a key-value data store vs. a more traditional relational DB?

When would one choose a key-value data store over a relational DB? What considerations go into deciding one or the other? When is mix of both the best route? Please provide examples if you can.
cdeszaq
  • 30,869
  • 25
  • 117
  • 173