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

Dynamic column names in view (Postgres)

I am currently programming an SQL view which should provide a count of a populated field for a particular month. This is how I would like the view to be constructed: Country | (Current Month - 12) Eg Feb 2011 | (Current Month - 11) | (Current…
Aydin Hassan
  • 1,465
  • 2
  • 20
  • 41
1
vote
1 answer

promote to inherited table in postgresql

Suppose I have a table Bars inheriting a table Foos. How could I promote a foo to a bar? Demoting a bar to a foo would be simple, by just deleting the row from Bars.
Flavius
  • 13,566
  • 13
  • 80
  • 126
1
vote
3 answers

Appropriate way to store this kind of information

I have to store the following information into a database, to be used by a .NET assembly. They are representing times that a certain color is active: RED: 16:30 - 18:30 Mon to Fri Incl Bank Holidays AMBER: 09:00 - 16:30 & 18:30 - 20:30 Mon…
m.edmondson
  • 30,382
  • 27
  • 123
  • 206
1
vote
1 answer

Inserting values into a relational database

I'm trying to insert some data into a relational database (MySQL using InnoDB engine) with the tables and columns below via PHP. Quiz(id, name) Questions(quiz_id, id, name) Answers(question_id, id, name) The primary key ids are all…
1
vote
2 answers

Database design. Should every table be link with a relationship

I am just trying to create a simple booking system for a restaurant. I have 5 tables at the moment. Member ---> Reservation <--- Exclusive Night Menu ---> Dish Above shows their relationship with each other. So a customer can make many reservations…
user667430
  • 1,487
  • 8
  • 38
  • 73
1
vote
1 answer

User defined formulas in a MySQL database

I have something like a snowflake schema that decomposes data that I get in spreadsheet form into the numeric values that go into one table and information about what was measured, on what subjects, what column of the spreadsheet it originaly…
bokov
  • 3,444
  • 2
  • 31
  • 49
1
vote
1 answer

Schema Design for Invoices and Payments - better model than M:M relationship?

There is a 1:1 relationship between invoices and projects in my existing schema. I am in the process of modifying it to allow for one project to have many invoices, but I also need to track payments. Currently, a single payment relates to 1 (or…
1
vote
1 answer

New to MySQL looking for Many-to-Many relationship query

Some background I have a set of data that represents the alchemy ingredients and their effects from Skyrim. If you're unfamiliar with this you can combine 2-4 ingredients to make a potion. Each ingredient has 4 effects. If any effects between…
pdizz
  • 4,100
  • 4
  • 28
  • 42
1
vote
2 answers

PHP / MySQL / ??? - Organizing articles and arbitrary-depth child articles where any article can be retrieved, along with all parents and children

I'm going to have a database of articles, or pages, sort of like wiki pages. All article names will need to be unique, much like a wiki page. They're going to be organized in a flexible-depth hierarchy, where each article can be a child or parent…
Eph
  • 53
  • 5
1
vote
2 answers

Database structure design

What is industrial best practice for bill to and ship to address tables? Do people combine them into 1 table or seperate them into 2 different tables? This is for general invoice. Thank you in advance!
gavin
  • 1,276
  • 1
  • 11
  • 17
1
vote
1 answer

Database Tables For Multiple Roles

I have an architecture problem about how to store data related to a specific role in a relational database. I have three roles, a Subscriber Contact, Teacher, and Student. They are all stored in the Users table, but have specific properties…
1
vote
2 answers

Some advice on how to model this database

I am setting up a website that will have users. Users can search for songs and (if signed in) save them to a playlist or their library of songs. I want it to be like iTunes in that all the songs on the the playlists are part of the library so when…
1
vote
2 answers

MySQL: Limit Results related to FROM with Joins that have multiple subelements

I habe a main table that i select from and a table with subelements that i select from in a join. Example: person skill person_to_skill id | name id | skill id | p_id | s_id ------------ ------------ …
Andresch Serj
  • 35,217
  • 15
  • 59
  • 101
1
vote
1 answer

how to best design the DB in this situation

At a glance, the database schema looks like this: The schema has to be in 3rd normal form (and I am aware that hotels.average_rating suggests otherwise, try to oversee that, since the database is not fully designed yet). This is for a tourist…
Flavius
  • 13,566
  • 13
  • 80
  • 126
1
vote
1 answer

CakePHP style database query results in Zend Framework using Zend_Db_Table?

If you have a complex SQL query involving many joins (for example returning Articles with their associated many to many Tags) is there anything in Zend Framework that will produce the lovely CakePHP style database results: Array ( [0] => Array …