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.

6390 questions
1397
votes
7 answers

What are the options for storing hierarchical data in a relational database?

Good Overviews Generally speaking, you're making a decision between fast read times (for example, nested set) or fast write times (adjacency list). Usually, you end up with a combination of the options below that best fit your needs. The following…
orangepips
  • 9,601
  • 6
  • 29
  • 56
386
votes
8 answers

What is the difference between Views and Materialized Views in Oracle?

What is the difference between Views and Materialized Views in Oracle?
juan
  • 74,179
  • 49
  • 153
  • 188
366
votes
7 answers

When and why are database joins expensive?

I'm doing some research into databases and I'm looking at some limitations of relational DBs. I'm getting that joins of large tables is very expensive, but I'm not completely sure why. What does the DBMS need to do to execute a join operation,…
Rik
  • 26,673
  • 13
  • 47
  • 65
272
votes
3 answers

Laravel - Eloquent "Has", "With", "WhereHas" - What do they mean?

I've found the concept and meaning behind these methods to be a little confusing, is it possible for somebody to explain to me what the difference between has and with is, in the context of an example (if possible)?
user4898812
222
votes
4 answers

Does the join order matter in SQL?

Disregarding performance, will I get the same result from query A and B below? How about C and D? -- A select * from a left join b on left join c on -- B select * from a left join c …
Just a learner
  • 21,448
  • 45
  • 133
  • 206
189
votes
10 answers

Storing time-series data, relational or non?

I am creating a system which polls devices for data on varying metrics such as CPU utilisation, disk utilisation, temperature etc. at (probably) 5 minute intervals using SNMP. The ultimate goal is to provide visualisations to a user of the system in…
169
votes
5 answers

Relational table naming convention

I'm starting a new project and would like to get my table- and column names right from the start. For example I've always used plural in table names but recently learned singular is correct. So, if I got a table "user" and then I got products that…
166
votes
6 answers

Difference between 3NF and BCNF in simple terms (must be able to explain to an 8-year old)

I have read the quote : data depends on the key [1NF], the whole key [2NF] and nothing but the key [3NF]. However, I am having trouble understanding 3.5NF or BCNF as it's called. Here is what I understand : BCNF is stricter than 3NF left side of…
Arnab Datta
  • 4,260
  • 6
  • 35
  • 60
160
votes
9 answers

NoSql vs Relational database

Recently NoSQL has gained immense popularity. What are the advantages of NoSQL over traditional RDBMS?
user496949
  • 75,601
  • 138
  • 297
  • 413
155
votes
4 answers

How to design a product table for many kinds of product where each product has many parameters

I do not have much experience in table design. My goal is to create one or more product tables that meet the requirements below: Support many kinds of products (TV, Phone, PC, ...). Each kind of product has a different set of parameters,…
StoneHeart
  • 14,122
  • 31
  • 65
  • 83
151
votes
5 answers

Foreign Key to multiple tables

I've got 3 relevant tables in my database. CREATE TABLE dbo.Group ( ID int NOT NULL, Name varchar(50) NOT NULL ) CREATE TABLE dbo.User ( ID int NOT NULL, Name varchar(50) NOT NULL ) CREATE TABLE dbo.Ticket ( ID int NOT NULL, …
Darthg8r
  • 10,869
  • 12
  • 54
  • 86
151
votes
12 answers

Using a Single Row configuration table in SQL Server database. Bad idea?

In developing a shopping cart application I've found that I needed to save settings and configurations based on the administrator's preferences and requirements. This information can be anything from company information, Shipping account IDs, PayPal…
David Murdoch
  • 82,194
  • 38
  • 141
  • 186
145
votes
9 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
  • 17,839
  • 14
  • 71
  • 118
143
votes
1 answer

postgresql foreign key syntax

I have 2 tables as you will see in my posgresql code below. The first table students has 2 columns, one for student_name and the other student_id which is the primary key. In my second table called tests, this has 4 columns, one for subject_id,…
127
votes
12 answers

Difference between one-to-many and many-to-one relationship

What is the real difference between one-to-many and many-to-one relationship? It is only reversed, kind of? I can't find any 'good-and-easy-to-understand' tutorial about this topic other than this one: SQL for Beginners: Part 3 - Database…
Zhaf
  • 1,454
  • 5
  • 16
  • 16
1
2 3
99 100