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
1
vote
3 answers

handling three tables with two one-to-many relationship among them

I have a three tables, A, B and C. A has many B, and B has many C. What is the best way design primary keys and relationship among these two. Sorry to ask a designing problem, but I don't know whether to use one extra table to map A(pkey) - B(pkey)…
1
vote
1 answer

How to enable escaping in the HSQLDB export command?

When I run the following script in HSQLDB 2.2.5 using the command java -jar sqltool.jar --rcFile sqltool.rc db_file q.sql, I got the following error message: Error message: SEVERE Error at 'q3.sql' line 16: "\xq SELECT "T1"."C1", "T1"."C2" FROM…
reprogrammer
  • 14,298
  • 16
  • 57
  • 93
1
vote
0 answers

Sql CE, SQLite and XML

I am developing an application for personal use and I don't know which is more efficient way to store my data. Ok, here is the case, My data structure includes 5-6 master detail tables. The application will be working locally. It will create…
Jim
  • 2,760
  • 8
  • 42
  • 66
1
vote
1 answer

MySQL ON UPDATE/ON DELETE CASCADE not CASCADEing

When I edit UID on the signup table, the parentid column on the clients table is supposed to change. It's not doing that. Any suggestions? Clients CREATE TABLE `clients` ( `id` INT(255) NOT NULL AUTO_INCREMENT, `fname` VARCHAR(255) NOT NULL…
Meisam Mulla
  • 1,845
  • 3
  • 23
  • 37
1
vote
1 answer

Changes in data and their effect on historical data

Say you have an simple CRM system with customers and orders. If a customer changes his name, will you prefer that the old historical orders get the new name as well, or do you copy it to a string value on the order to preserve the accuracy? I doubt…
rozon
  • 2,518
  • 4
  • 23
  • 37
1
vote
2 answers

select row that column2 not equal to column1

I need help with a SQL Query I have this table likes friend friend2 1 2 2 1 3 1 4 5 I need to select only one pair of the friends that like each other. With my current select I'm…
Garis M Suero
  • 7,974
  • 7
  • 45
  • 68
1
vote
4 answers

SQL command to concatenate several rows into one cell?

I have a table of user group assignments, such as: ID----UserName------Group 01 johnsmith admin 02 sarahwilles admin 03 johnsmith testuser I would like to display it as: UserName-------Groups johnsmith admin,…
antonpug
  • 13,724
  • 28
  • 88
  • 129
1
vote
4 answers

What is the most efficient way to store an unknown number of records in a database?

What is the best way to store data if I don't know in advance how much data I might have? The application is that I want to keep track of the employment history of a bunch of people, but I don't know how many places each person has worked. Would it…
jonlucc
  • 37
  • 6
1
vote
3 answers

How to use PRIMARY KEY in mysql normalized database

The general form of a many-to-many relationship is to create three two-column tables (e.g. to relate favorite movies of members). Two tables are list of movies and members. In these two tables, we assign an auto_increment ID (which is primary…
Googlebot
  • 15,159
  • 44
  • 133
  • 229
1
vote
2 answers

Database table with many rows - correct use

This is more of a theoretical question and i think the best way would be to start from an example. Let's say that I have a rating system. Every user can rate any item once and every item can be rated by any user only one time. I want to present…
TGM
  • 1,659
  • 10
  • 30
  • 45
1
vote
2 answers

Partial export of db tables according to a select on master table

to accomodate testing in a large batch system I would like to have the possibility to export data from many tables that are all in a "master - detail" relationship, i.e. they are connected via foreign keys. I know I can do that programmatically via…
Chris
  • 347
  • 1
  • 11
1
vote
1 answer

Zend_DB and MVC models matching database tables

I've been reading something from Bill Karwin (creator of Zend_DB) about models not being directly to do with database tables. (I think some devs have their models a direct extension of Zend_tables or so which makes it harder for adding memcached…
1
vote
3 answers

Candidate Key Identification with Functional Dependencies

I'm having trouble understanding how to identify keys in functional dependencies. I've been looking at examples, for example: Given a relation ABCD, find all keys not including superkeys of the A -> BC, C -> D, CD -> AB. This gives keys C and A.…
1
vote
1 answer

BCNF/3NF in Relational Databases

How do you tell if a relation R is in BCNF and 3NF? I'm reading a textbook, and it's telling me that there are 3 main attributes you're looking at, but I'm having trouble understanding what they're saying, or at least applying what they're saying…
dxu
  • 459
  • 2
  • 5
  • 13
1
vote
3 answers

Primary keys for a table with a submission ID, a user ID and a submission order

I am building the database for a web application where users may submit data. Each datum is unique, and more than one user can submit the same datum. It is important, from the application's standpoint, to know the order in which users submitted the…
F. P.
  • 5,018
  • 10
  • 55
  • 80