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

How to distinguish normal white space characters with other white space characters

For example: In MySQL. the data type Text, If we have a column defined as Text in a MySQL table, when to retrieve value of this column in JDBC, you get the value with excess trailing spaces, you can call String#trim(), but if such column is intended…
CaiNiaoCoder
  • 3,269
  • 9
  • 52
  • 82
1
vote
1 answer

Doctrine 2 mutually exclusive relations

I have an entity Content, with relation to either FileImage or FileVideo. What is the proper way of doing this in Doctrine 2? Content should relate to FileImage or FileVideo, never both, and never none. What's a working example to solve the above…
Jon Skarpeteig
  • 4,118
  • 7
  • 34
  • 53
1
vote
3 answers

MySQL Database Design Suggestions

I have the following fields in my table: id - user_id - display_time - icon_id - background_id - page_name - template_id - sort_id - time Basically, each user has their own slides that they can create and these are just some settings within it. …
Drew
  • 6,736
  • 17
  • 64
  • 96
1
vote
1 answer

Best schema for a complex relation in a database

I'm not an expert in databases, so this is complex for me but maybe it's no for a lot of people. I have the following: quiz: Table which contains some quizzes project: Table which contains some projects project_has_quiz: A many-many relationship…
1
vote
3 answers

Relations in SQL Server and optimization

I was a developer in a certain project developed under sql-server and .Net, they don't use physical relations between their tables but they use logical ones " logical foreign keys ". I asked them that for what reason they do that ,they say "it is…
1
vote
2 answers

Rails 3 : User's coworkers in organization relationship?

I have this relationship : class Organization < ActiveRecord::Base has_many :users end class User < ActiveRecord::Base belongs_to :organization end And I would like to gather a user's coworkers (i.e. who has joined the same organization). The…
1
vote
1 answer

MySQL Database Design for a list of services

Below is a preview of the type of list I am talking about. What is going to happen is each user is going to have their own list that they can create. They will be able to modify the headings (Maintenance, Tire Services) and modify each item and…
Drew
  • 6,736
  • 17
  • 64
  • 96
1
vote
2 answers

MySQL - When to add new rows to user table and when to create new table?

So I am creating a database and I have a few questions because I am not too sure if it's best to just add this to the users table or create a new table for it. So my users table has the following fields: id, shop_name, address, city, state,…
Drew
  • 6,736
  • 17
  • 64
  • 96
1
vote
1 answer

Grails GORM mapping FK that is not the PK of the other table

How do I map a GORM association where the foreign key is not a PK of the other table? I have the following schema: CREATE TABLE `supplier` ( `id` int(11) NOT NULL AUTO_INCREMENT, `partner_id` int(11) NOT NULL, `supplier_id` int(11) NOT NULL …
ryanprayogo
  • 11,587
  • 11
  • 51
  • 66
1
vote
2 answers

MySQL multiple foreign keys

I'm new to setting up relational databases. I'm trying to create two tables in MySQL, a USER table and a COMPANY table. Both should be able to have multiple phone numbers associated with them, so I created a PHONE table and wanted to have a…
mag725
  • 695
  • 2
  • 9
  • 22
1
vote
3 answers

Query for Current_Timestamp between Start- and End-Time (w/o Date!) Oracle PL/SQL

I have a time (without date component) like 9am, let's say it's the current time. I want to query all entrys from a table where this time is between a Start and a End time stored as Timestamp. How do I do this? Should I store it differently? I tried…
user1054247
  • 145
  • 1
  • 2
  • 6
1
vote
2 answers

Restful Web Services - Maintaining Foreign Keys

Am I misunderstanding a basic concept of Restful web services? I have an Android app that I am trying to use a Restful PUT. Two Mysql tables Country and StateProvince with countryId a foreign key on StateProvince table. If I try to do a PUT to…
1
vote
3 answers

Database schema pattern for grouping records

I'm looking for a design pattern to manage records in a relational database which belong together, e.g. grouping multiple contacts. The group itself does not need to be an entity. A group should have an unlimited count of members. It should be…
1
vote
2 answers

Database Design for "common concepts"

In the project I'm developing I've got several "common objects" that span and associate several other tables. Think, for example, at the object "Comment". It should be applicable to many kind of different objects: a photo, an action, an event... and…
1
vote
3 answers

Object Model Design

I had a question about the best way to handle this type of data. In my system, I will have many users and many accounts... users are able to belong to many accounts, and accounts will have many users. I'm guessing the best way to accomplish this is…
ThinkingInBits
  • 10,792
  • 8
  • 57
  • 82