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
11
votes
3 answers

Average posts per hour on MySQL?

I have a number of posts saved into a InnoDB table on MySQL. The table has the columns "id", "date", "user", "content". I wanted to make some statistic graphs, so I ended up using the following query to get the amount of posts per hour of…
Daniel Sorichetti
  • 1,921
  • 1
  • 20
  • 34
10
votes
4 answers

Switching the values of two fields/columns in SQL Server without third variable

As a result of a mistake during an import to the a test table called CUSTOMERS, I found myself needing to switch the values of two columns in SQL Server. I mistakenly imported the respective values for LASTNAME and FIRSTNAME into the opposite fields…
TelJanini
  • 835
  • 9
  • 25
10
votes
4 answers

Clear explanation of the "theta join" in relational algebra?

I'm looking for a clear, basic explanation of the concept of theta join in relational algebra and perhaps an example (using SQL perhaps) to illustrate its usage. If I understand it correctly, the theta join is a natural join with a condition added…
LuxuryMode
  • 33,401
  • 34
  • 117
  • 188
10
votes
6 answers

Should User and Address be in separate tables?

Currently my users table has the below fields Username Password Name Surname City Address Country Region TelNo MobNo Email MembershipExpiry NoOfMembers DOB Gender Blocked UserAttempts BlockTime Disabled I'm not sure if I should put the address…
Enzero
  • 1,141
  • 2
  • 17
  • 36
10
votes
3 answers

MySQL Database column having multiple values

I had a question about whether or not my implementation idea is easy to work with/write queries for. I currently have a database with multiple columns. Most of the columns are the same thing (items, but split into item 1, item 2, item 3 etc). So I…
Eric
  • 235
  • 3
  • 10
  • 17
10
votes
3 answers

Is storing graphs in MySQL a good idea?

I am using MySQL to store reports from a tool. I am extremely happy with the speed and flexibility with which users can query data. The tool also has some data which is a graph. My question is, is it a good idea to store the graph in MySQL? The…
SAN
  • 2,219
  • 4
  • 26
  • 32
10
votes
3 answers

PostgreSQL: Why does this simple query not use the index?

I have a table t with a column c, which is an int and has a btree index on it. Why does the following query not utilize this index? explain select c from t group by c; The result I get is: HashAggregate (cost=1005817.55..1005817.71 rows=16…
David
  • 4,786
  • 11
  • 52
  • 80
10
votes
1 answer

PostgreSQL row-level security involving a view or a select with join

(suggestions for a better or more-descriptive title are welcome). I wonder if the following is possible in PostgreSQL using RLS (or any other mechanism). I want a user to be able to update certain rows of a table if its username matches a column in…
10
votes
5 answers

PostgreSQL find locks including the table name

I'm trying to take a look at locks that are happening on specific tables in my PostgreSQL database. I see there's a table called pg_locks select * from pg_locks; Which seems to give me a bunch of columns but is it possible to find the relation…
10
votes
7 answers

Why does SQL standard allow duplicate rows?

One of the core rules for the relational model is the required uniqueness for tuples (rows): Every individual scalar value in the database must be logically addressable by specifying the name of the containing table, the name of the containing…
Jaanus Varus
  • 3,508
  • 3
  • 31
  • 49
10
votes
2 answers

Left join in influx DB

I am new to influx DB. Now I need to migrate MySQL db into influxDB. I chose influx DB because it support SQL like queries. But I could not found left join in it. I have a series called statistics which contains browser_id and another series…
Sajith
  • 2,842
  • 9
  • 37
  • 49
10
votes
6 answers

Migrate data from relational DB to NoSQL

Is it possible/are there tools/ best practices etc to migrate data to a NoSQL format from a relational DB. I have a JEE6 app making use of Hibernate ORM to persist to MySQL but now we wish to move to NoSQL solution but need to bring the existing…
user1843591
  • 1,074
  • 3
  • 17
  • 37
10
votes
5 answers

How to convert data stored in XML files into a relational database (MySQL)?

I have a few XML files containing data for a research project which I need to run some statistics on. The amount of data is close to 100GB. The structure is not so complex (could be mapped to perhaps 10 tables in a relational model), and given the…
E.Z.
  • 6,393
  • 11
  • 42
  • 69
10
votes
2 answers

Which is a good design for a database table that can be owned by two different resources, and therefore needs two different foreign keys?

My application has notification settings for users that can belong to groups. A group administrator can define settings for the entire group, so that when any user performs an action, the administrator is notified. The administrator can also define…
Logan Serman
  • 29,447
  • 27
  • 102
  • 141
10
votes
2 answers

How to implement Twitter retweet action in my database

I am implementing web application similar to Twitter. I need to implement 'retweet' action, and one tweet can by retweeted by one person multiple times. I have a basic 'tweets' table that have columns for: Tweets: tweet_id | tweet_text |…
Roman Mazur
  • 512
  • 6
  • 17