database

Adding Postgres table cells based on same value

I have a table called expenses. There are numerous columns but the ones involved in my php page are date, spplierinv, amount. I have created a page that lists all the expenses in a given month and totals it at the end. However, each row has a value, but many rows might be on the same supplier invoice.This means adding each row with the s...

postgresql syntax while exists loop

I'm working at function from Joe Celkos book - Trees and Hierarchies in SQL for Smarties I'm trying to delete a subtree from an adjacency list but part my function is not working yet. WHILE EXISTS –– mark leaf nodes (SELECT * FROM OrgChart WHERE boss_emp_nbr = −99999 AND emp_nbr > −99999) LOOP –– get list of next...

h2 in-memory tables, remote connection

I am having problems with creating an in memory table, using H2 database, and accessing it outside of the JVM it is created and running in. The documentation structures the url as jdbc:h2:tcp://<host>/mem:<databasename> I've tried many combinations, but simply cannot get the remote connection to work. Is this feature working, can anyon...

visual studio 2010 database project, is there a visual way?

started a visual studio 2010 database project. however i am only able to write sql in a text mode, there is no functionality in making the table for example in a visual view as exists when you add a new database to app_data folder and the work on it there. is this the only way and there is no visual way of doing this in the visual studi...

How to Map a table with another lookup table using JPA?

Hi, I have two tables: 1) Application(int appid, int statusid, String appname, String appcity with getter and Setter methods) 2) App_Status(int statusid,String statusDescription with setter and getter methods) I want to map Application table with App_Status so that I don't have to query separately App_Status table in order to get the...

User Management: Managing users in user-defined "groups", database schema and logistics

I'm a noob, development wise and logistically-wise. I'm developing a site that lets people take a test... My client wants the ability for a user with the roll/privledge "admin" (a step below a super-admin) to be allowed to create users and only see/edit the users that they create... The users created in that "category" or group need s...

Client to server data upload

I'm trying to design a system similar to the traditional server monitoring systems like MOM, Tivoli, Open View, where an agent will record data and then upload it to a central database once a day, but them also be able to send immediate alerts back to the server. I'm not sure what the best methodology might be for this. I've started look...

Delphi: how to create Firebird database programmatically

I'm using D2K9, Zeos 7Alpha, and Firebird 2.1 I had this working before I added the autoinc field. Although I'm not sure I was doing it 100% correctly. I don' know what order to do the SQL code, with the triggers, Generators, etc.. I've tried several combinations, I'm guessing I'm doing something wrong other than just that for this not ...

OO Design - Reduce a Long List of Methods

I have a simple application that loads data from an XML file to a database. public class EmployeeLoader() { public void LoadEmpoyees() {...} public void LoadSalaries() {...} public void LoadRegistrationData() {...} public void LoadTaxData() {...} } Is it a good idea to have multiple "Load" methods a...

Charts or Stats comparing Database vs. HTTP vs. Direct File Access Performance?

I am wondering what the stats are for different ways of storing (and therefore retrieving) content. Are there any charts out there, or do you guys have any quick tests to show, the requests per second, etc., of: Direct (local) database access, vs. HTTP Access to cached data, vs. HTTP Access to uncached data (remote database), vs. Dire...

How much faster is a database running in RAM?

I"m looking to run PostgreSQL in RAM for performance enhancement. The database isn't more than 1GB and shouldn't ever grow to more than 5GB. Is it worth doing? Are there any benchmarks out there? Is it buggy? My second major concern is: How easy is it to back things up when it's running purely in RAM. Is this just like using RAM as tier...

Deleting partial data from a field in MySQL

I am trying to remove a specific set of data from a MySQL database field, however I am not sure what the best statement would be for this. For example, if I have a data in a field such as... The use of a secondary password will allow you to gain access to your account from a non-authenticated computer. A non-authenticated computer is ...

Persistent (purely functional) Red-Black trees on disk performance

I'm studying the best data structures to implement a simple open-source object temporal database, and currently I'm very fond of using Persistent Red-Black trees to do it. My main reasons for using persistent data structures is first of all to minimize the use of locks, so the database can be as parallel as possible. Also it will be eas...

General ORM design question

Suppose you have 2 classes, Person and Rabbit. A person can do a number of things to a rabbit, s/he can either feed it, buy it and become its owner, or give it away. A rabbit can have none or at most 1 owner at a time. And if it is not fed for a while, it may die. Class Person { Void Feed(Rabbit r); Void Buy(Rabbit r...

Schema design: many to many plus additional one to many

Hi, I have this scenario and I'm not sure exactly how it should be modeled in the database. The objects I'm trying to model are: teams, players, the team-player membership, and a list of fees due for each player on a given team. So, the fees depend on both the team and the player. So, my current approach is the following: **teams** ...

Connecting to a fresh SQL Server installation

I know mysql, and I'd like to learn sqlserver. I'm currently stuck on the basics of basics: How to install and configure sql server How to connect to it I installed Sql Server through Web Platform Installer, and have Visual Studio 2008 installed. Still, I can't understand how to connect to my server: I see that the SQL service itse...

Visual Studio 2010 deploys views too late in deploy process

I have a database project in my VS2010 solution. I recently changed a view and and changed a number of functions to use this view instead of going directly against a table. But now when I deploy I get errors on most of these functions because the column asked for does not exists in the view yet. The update of the view happends later than...

nginx_http_push_module and databases

i am a newbie of nginx , and i am using nginx as a comet server by nginx_http_push_module i have two question: 1,how can i save the messages which recieved by nginx_http_push_module into databases ? 2,how can i get listeners list of a channel ? thanks~ ...

Date range intersection in SQL

I have a table where each row has a start and stop date-time. These can be arbitrarily short or long spans. I want to query the sum duration of the intersection of all rows with two start and stop date-times. How can you do this in MySQL? Or do you have to select the rows that intersect the query start and stop times, then calculate ...

How to insert an n:m-relationship with technical primary keys generated by a sequence?

Let's say I have two tables with several fields and in every table there is a primary key which is a technical id generated by a database sequence: table1 table2 ------------- ------------- field11 <pk> field21 <pk> field12 field22 field11 and field21 are generated by sequences. Also there is a n:...