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
1580
votes
8 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,891
  • 6
  • 33
  • 57
424
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
  • 80,295
  • 52
  • 162
  • 195
422
votes
4 answers

How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?

Can anyone explain how to implement one-to-one, one-to-many and many-to-many relationships while designing tables with some examples?
arsenal
  • 23,366
  • 85
  • 225
  • 331
405
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
  • 28,507
  • 14
  • 48
  • 67
372
votes
2 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
267
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? ----- Scenario 1: -- A (left join) select * from a left join b on left join c on -- B (left…
Just a learner
  • 26,690
  • 50
  • 155
  • 234
202
votes
9 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
  • 12,377
  • 15
  • 63
  • 100
201
votes
2 answers

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, one…
Hamza
  • 2,180
  • 3
  • 14
  • 18
196
votes
8 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…
189
votes
5 answers

Relational table naming convention

I'm starting a new project and would like to get my table and column names right. For example I've always used plural in table names but recently learned singular is correct. So if I have a table user and I have products that only the user will…
183
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
  • 5,356
  • 10
  • 41
  • 67
173
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
  • 15,790
  • 32
  • 67
  • 84
165
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
  • 87,823
  • 39
  • 148
  • 191
162
votes
9 answers

NoSql vs Relational database

Recently NoSQL has gained immense popularity. What are the advantages of NoSQL over traditional RDBMS?
user496949
  • 83,087
  • 147
  • 309
  • 426
161
votes
15 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,804
  • 5
  • 19
  • 16
1
2 3
99 100