This tag is for general database questions; if you question is specific to SQL use that tag instead.

learn more… | top users | synonyms (1)

4
votes
3answers
93 views

How to track temporal changes in a database?

Imagine a software for theater owners. You can accept reservations for the different cinema halls. Each hall has a different number of seats. Say the owner wants to know how many people visited the ...
4
votes
4answers
181 views

How to prevent race conditions in a web application?

Consider an e-commerce site, where Alice and Bob are both editing the product listings. Alice is improving descriptions, while Bob is updating prices. They start editing the Acme Wonder Widget at the ...
3
votes
2answers
196 views

Why Do B+ Trees Have a Minimum Occupancy of 50%?

As far as I can tell, the basic operations (add, delete, search) on a B+ Tree would function the same if minimum occupancy was 1, or 1/3, or any other function on node size. All the sources available ...
2
votes
0answers
43 views

String comparison equivalence between mysql database and php code

I wonder if it is possible to compare two strings using mysql and php and obtain the same results. In mysql I have a = b collate utf8_general_ci For PHP I found a promising way to do it with the ...
0
votes
1answer
105 views

calculating the average of a value over a month [on hold]

I am working on a project right now that is having me calculate monthly interest on a bank account. The way the interest is supposed to be calculated is as follows: Use the daily average to calculate ...
-1
votes
0answers
29 views

How to add premium (featured ) user in an Entity–relationship diagram? [on hold]

I have a table 'User' in my database. When the user makes a payment after placing an order for a package, he is considered a Featured(Premium) user of a company. How do I add this Premium (Featured ...
-1
votes
0answers
21 views

Does a database update force index rebuild regardless of updated field? [migrated]

With MySQL (InnoDB), I understand that having indexes slow down UPDATE queries. I would like to know if this happens regardless of what fields are updated. For example, if I have a table with 20 ...
0
votes
0answers
27 views

Entity Framework Lookup Tables

I am coming from working with ADO.net DataSets and feel fairly comfortable with how they work. Mainly, I usually have a DATA table with a large number of REF tables for lookups. In DataSets it was ...
0
votes
0answers
6 views

Syncing structured data and files in Android App with an ORM?

I am developing an Android App which I have developed for iOS before. The app requires that structured data and files are synced across android devices. In iOS, I was using Core Data and synced to ...
2
votes
2answers
36 views

Bulk update in client-server application

Sometimes when coding a client-server application, the client needs to make a bulk update. For example: "mark all pending orders as dispatched". To implement these I typically write specific ...
-1
votes
0answers
46 views

Database and (micro) ORM for new .NET desktop app? [closed]

I hope my long story with more than one question fits in Programmers stackexchange. I tried to make make questions simple and not speculative. Thanks in advance. Introduction I plan to write a ...
0
votes
0answers
9 views

compare different approachs for saving related records whose values may change

On a web application for accounting services, I have the good old Invoice. To keep this example as simple as possible, each Invoice has many rows, and each row has its item with its price. At the ...
-1
votes
2answers
71 views

Should I go with MongoDB Free Version? [closed]

We are assembling a system where we will be storing several million documents in the range of 1 - 2KB each. My first instinct was to use SQL Server because that's just what I've done for many years. I ...
2
votes
1answer
59 views

Managing Database version controlled migrations using a list/table

I'm not much of an expert in the area but I am aware that solutions already exist to managing database migrations in version control, e.g. sqitch and liquibase. However I'm currently planning a small ...
0
votes
0answers
47 views

Passing values from custom columns [on hold]

This question is a bit subjective so the intention is to get some feedback on a problem I'm experiencing and ways around it. The kind of answer I'm expecting will answer the question "what are good ...
0
votes
0answers
44 views

Automatically verifying INSERTs when building a PHP(5.3.3) application

I am building a form in PHP. I would like to automatically verify that INSERT queries are successful, and populate data correctly, as opposed to running queries in Workbench or MySQL with every code ...
1
vote
1answer
20 views

Proper tree NoSQL structure with focus on full-text searching

I developing an app with tree(folder-file) structure, on which I should perform full-text searches with MongoDB. I did a research on the best tree structure practices and found this great article, but ...
2
votes
3answers
153 views

What are the advantages/disadvantages of creating a new set of tables for each user?

I'm working/playing on an app where individual users' data will be completely independent from each other. Of course, there will be common tables for other parts of the app (e.g. "users"), but for the ...
0
votes
1answer
60 views

Would it make sense to have a database table with only one record for tracking site summary stats?

I'm creating a web site that deals with monetary transactions. Users can deposit funds into a wallet and use them on the site. I'd like to keep track of some stats for the web site, like revenue and ...
2
votes
2answers
104 views

Designing a system to archive databases with referential integrity

I have a very large Oracle database, with many many tables and millions of rows. I need to delete some of the rows end-to-end. By end-to-end, I mean, if I want to delete a row from a table then I must ...
0
votes
0answers
57 views

When to use a message queue as a web service database?

Does it make sense to implement a message queue system such as RabbitMQ or Kafka for the purpose of storing data in a queue? For example, this could be done in order to handle things such as ...
1
vote
0answers
62 views

Entity Framework Code First Centralized database deployment

I originally posted this on stack overflow but was told that here is a better place to ask this kinda stuff. I couldn't find any other similar answered question but if there is one please give me a ...
2
votes
3answers
105 views

What is a Database Environment?

I am going through Relational Database Design by JLM. I have come across words like database, data model, DBMS etc. which I am able to understand. But, I get confused when the author tries to use ...
1
vote
1answer
39 views

Reduce Operations on Distributed Databases

I would like to ask you about optimizing reduce operations (e.g. count) on multiple databases. Let's say there is a user table that is stored in various countries and sharding is made based on the ...
2
votes
2answers
103 views

Separation of retrieving data and business objects between DAL and BLL Layers

I did some research before posting this question. Among other questions or post, one of those is provided below. I could not get a clear mind how to determine.. Business Objects within a Data Access ...
3
votes
1answer
88 views

Fixing bad data in a database - redo or incremental

I have pseudo-ownership of a fairly old db (original data from 30 years ago; current design is >15 years old). In my opinion, the schema is pretty broken, and one of the implications of this is that ...
1
vote
1answer
73 views

Normalization 3NF and BCNF

If I have the following relation R = (A, B, C, D) And the functional dependencies: A -> B, B -> A, CDB -> A, CDA -> B The candidate keys are CDA and CDB. The third normal form says that ...
13
votes
3answers
2k views

Database schema for a ToDo list

I am trying to make a very simple todo list application with PHP, MySQL, Jquery templating and JSON... However, my schema seems to complicate things in JSON. What's the best way to do it? A new ...
2
votes
5answers
82 views

Using DDL commands in programming language [duplicate]

Hello I am a student with no industry experience. My question may sound dumb, but, me and my friends were having discussions on use of DDL directly in programming language (any language may be Java, ...
6
votes
4answers
375 views

Heterogeneous Associations - Data Modeling When an Object that Must Relate to One of Many Classes

Suppose you have 3 classes: ClassA, ClassB and ClassC. Now suppose you have a class Message. You want a one-to-many relationship between each one of those three classes and the Message. The goal is ...
1
vote
3answers
105 views

Database design: 4 types of users but have different functionality , separate or one table?

I have 4 types of users: Admins , normal user , company , service provider admins and normal user share some attributes (id .first name ,last name ,phone ,mail) company and service provider share ...
1
vote
1answer
63 views

How to associate both a collection and one item of this collection to an entity

I'm working on a project in which I have an entity, we may call Users and another entity Address. I want to define the entity User in a way that an user would have a collection of addresses ...
1
vote
1answer
105 views

What is the point behind building an abstraction layer PDO Adapter class instead of using native PDO?

I have built a PDO adapter class because I thought, at the time anyway, it would be a good idea. After fighting with it, it makes no sense to me. Isn't the design of PDO the way it is to keep you ...
1
vote
1answer
80 views

Transferring information between a web server and a Python backend?

I have been Googling my problem but haven't been able to come up with anything; here's the situation: I have a PHP / MySQL website hosted with 1and1.com. I also have a Python program that runs on a ...
-1
votes
1answer
64 views

Stored procedure in asp.net webforms [duplicate]

Previously while working on database in asp.net I was using stored procedure with no tier architecture. So I was including connection string, crud query etc in every button click event. Then I was ...
0
votes
1answer
65 views

Three-Phase Commit (3PC) question

I've been reading about 3PC in a text book, but there aren't any diagrams or examples, so I found one on wikipedia that I posted below. My question is, what does it mean by "cohorts?" There is no ...
1
vote
0answers
70 views

Three phase commit protocol

I'm trying to understand the three phase commit protocol by reading the wiki page (http://en.wikipedia.org/wiki/Three-phase_commit_protocol#Motivation). In the description for the diagram I posted ...
-1
votes
1answer
105 views

SQLDatabase: Read a lot of data at once and process in memory or read the data when I need it?

I'm not sure how to approach this problem. I require a big chunk of data records from the SQL server. This chunk is based on variables, so I don't know before what records I need. I need to do a large ...
0
votes
0answers
18 views

searching for a user's friends

I have a rails that uses sunspot/solr for searching a number of models in our app. We are now adding a feature for searching for a user's friends. So if I look for "joe" all of my friends named ...
1
vote
1answer
43 views

What should the payload of a “domain event” generated through “change data capture” include?

Using domain driven design and event sourcing ... Given I have a table of 3 columns: (A, B, C) with an existing row of data: (1, 2, 3), when I update the row to contain values (1000, 2, 3) and I run ...
12
votes
8answers
684 views

When does one hard-code actual data values into the code as opposed to using a DB?

A long-standing question for me has been: when do I store data (actual values) in a database table, and when do I store them right in the code? The untold consensus (*) has typically been as such: ...
0
votes
3answers
100 views

Website testable design [duplicate]

I have developed two web services. The main service is a RESTful service (using DB), and another UI service that uses the RESTful service. Say I want to test the UI for now (integration tests), every ...
1
vote
1answer
88 views

Database choice [closed]

I am working on a system where I am replacing and existing Cobol system with C#. For the database I have hit some requirement which I am having a hard time to find complete support for (tried SQLite ...
1
vote
1answer
89 views

Representing list of polymophic objects in db

Let's suppose I have a list of derived objects from some base: class Circle : public Shape; class Rectangle : public Shape; There is object, which has vector of Shape * as member variable: class ...
3
votes
3answers
203 views

Is there a 'standard' SQL that can replace all the various custom versions?

I have been writing SQL for over 10 years now. I am extremely proficient at it and have experience working in SQL Server, Oracle, MySQL, PostgreSQL, etc. While there are multiple standards out there, ...
0
votes
0answers
28 views

How can I aggregate data from separated databases in more efficient way?

Firstm I'm using PostgreSQL 9.3. I'm solving the problem which is to retrieve a data from a separated databases and to render it into a web page. The web project is on the Java (JSF 1.2). Presently ...
-3
votes
1answer
96 views

How can I test a method which aggregates data from a database? [closed]

I'm developing the web Java application and come across the following issue: I'm using jUnit 4.5. Suppose that I have a method which aggregates data from a database for the rendering their to a ...
1
vote
2answers
105 views

When should I implement authentication in a database?

I'm currently embarking on a MongoDB project (a simple user login system), and I notice that there is an option for authentication. Here is the server string, with the userinfo shown as optional ...
2
votes
2answers
107 views

Combine union with distinct

Situation: I need distinct results from two tables, that both have duplicates. I would like to know if I should combine UNION and DISTINCT. Example 1 - Only use distinct SELECT DistinctValue FROM ...
15
votes
4answers
3k views

Databases: Where should the application logic run? [duplicate]

http://highscalability.com/blog/2010/11/9/facebook-uses-non-stored-procedures-to-update-social-graphs.html talks about how Facebook moved logic out of the database into the application in order to ...