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
12
votes
2 answers

Laravel 5.6 Polymorphic relation with whereHas

I am facing an issues in Polymorphic relation where I can not make whereHas to work. Basically I have a "where" condition which i want to apply. The relation code is working fine to return the related models but it returns errors once applying the…
12
votes
2 answers

Does MySQL support partial indexes?

Partial indexes only include a subset of the rows of a table. I've been able to create partial indexes in Oracle, DB2, PostgreSQL, and SQL Server. For example, in SQL Server I can create the index as: create index ix1_case on client_case (date) …
The Impaler
  • 45,731
  • 9
  • 39
  • 76
12
votes
1 answer

Data integrity across the databases of different Microservices

I am using relational databases for my microservices. I have CustomersMService which has its own database with table Customer, then I have OrdersMService which also has its own database but with table Order, and that table has column CustomerId. How…
12
votes
1 answer

Does a drop table also drop the constraints?

When I drop a table does it also drop the constraints?
Simon B
  • 179
  • 1
  • 1
  • 9
12
votes
7 answers

Is it bad to use redundant relationships?

Suppose I have the following tables in my database: Now all my queries depend on Company table. Is it a bad practice to give every other table a (redundant) relationships to the Company table to simplify my sql queries? Edit 1: Background is a…
svenwltr
  • 17,002
  • 12
  • 56
  • 68
12
votes
1 answer

Modelling algebraic data types using relational database

Say you are writing an app in OCaml/F#/SML/Haskell and want to persist data in a relational database. It is easy to map product types (records and tuples) to relations, but how do you map variant types to relations? To be concrete, how would you…
Vladimir Keleshev
  • 13,753
  • 17
  • 64
  • 93
12
votes
2 answers

Why Projection Operator in relational algebra eliminates duplicates?

What are the consequences of eliminating duplicates in Projection Operator?And yes, why there is no duplicate elimination in real systems, unless specified?
Ashish
  • 358
  • 2
  • 4
  • 15
12
votes
7 answers

C# Importing Large Volume of Data from CSV to Database

What's the most efficient method to load large volumes of data from CSV (3 million + rows) to a database. The data needs to be formatted(e.g. name column needs to be split into first name and last name, etc.) I need to do this in a efficiently as…
guazz
  • 121
  • 1
  • 3
12
votes
3 answers

Laravel / Eloquent : hasManyThrough WHERE

In the documentation of Eloquent it is said that I can pass the keys of a desired relationship to hasManyThrough. Lets say I have Models named Country, User, Post. A Country model might have many Posts through a Users model. That said I simply could…
user3518571
  • 407
  • 2
  • 5
  • 11
12
votes
2 answers

Does Eloquent relation sync also remove?

When updating a model and I sync a relationship, if I don't pass in all the ids that already exist, will that relationship be removed?
Jason Spick
  • 6,028
  • 13
  • 40
  • 59
12
votes
2 answers

Any good relational database tutorials?

I am looking for how to build a relational mysql database, and I would like to follow a tutorial. I need one that shows how to make multiple tables, and link those together using an id. Which I can later use to grab relational data from the…
Nic Hubbard
  • 41,587
  • 63
  • 251
  • 412
12
votes
3 answers

one to many vs many to many relationship

I just started learning database and I'm confused with using one to many vs many to many relationship. so I came up with a simple example on the relation beside customer and food. Customers orders food. 1)If i use one to many relationship, I will…
user2947249
  • 187
  • 2
  • 3
  • 11
12
votes
3 answers

How similar are Relational Database Languages and Logic Programming?

What are the similarities and differences in terms of the fundamental concepts and implementation between a relational database language sql and a logic programming language such as prolog and clojure's core.logic? Are the two interchangeable?
zcaudate
  • 13,998
  • 7
  • 64
  • 124
11
votes
2 answers

Can a database attribute be primary and foreign key?

I have 2 tables, User and Employee. Each user is given a User_ID and that is a primary key in the User table and a foreign key in the Employee table. Can that attribute in the Employee table also be a primary key?
RichardG
  • 445
  • 3
  • 8
  • 17
11
votes
5 answers

How to model a database with many m:n relations on a table

I am currently setting up a database which has a large number of many-to-many relations. Every relationship was modeled via a link table. Example: A person has a number of jobs, jobs are fulfilled by a number of persons. A person has a number of…