database

Is DDD fit for our scenario?

We are trying to come up with an API and serve data-intensive services to potential users. Our scenario: we are more of less a data vendor where we store massive amount of data in normalized database and use queries to retrieve them to be displayed in data-driven web applications. Now, we want to create an API that clients can use to cr...

Preferred syntax for adding SQL SUMs together

I want to return the total sales. That is to say the UnitPrice + TaxAmount for the entire set of data. I can write the SQL query two different ways with the same result returned. SELECT SUM(UnitPrice + TaxAmount) AS 'TotalSales' FROM Sales or SELECT SUM(UnitPrice) + SUM(TaxAmount) AS 'TotalSales' FROM Sales Is one of these que...

Object Oriented databases

Hello, This is the first time i am working with the object oriented databases.I was associated with the RDBMS for past few years. But now.. coming to this world of object oriented databaseS, I am kind of concerned about the aftermaths of the creation or design of the db. My concern is the population or Migration of this object oriente...

how to declare global variable in sql

Hi, I would like create a GLOBAL VARIABLE in a Sql script. For my understanding using DECLARE I will be able to create just LOCAL variable. Any idea how to create theem? thanks ...

How to generate printable (and savable) forms with Java?

Here is my situation. I have written a Database application in Java. Now (unfortunately as an afterthought) I want to generate forms from data I pull from the database. By form I mean a savable and printable file (not anything to do with UIs or swing). Basically I want to take a template form and fill in things from the data I pull from...

How would you implement a very wide "table"?

Let's say you're modeling an entity that has many attributes (2400+), far greater than the physical limit on a given database engine (e.g. ~1000 SQL Server). Knowing nothing about the relative importance of these data points (which ones are hot/used most often) besides the domain/candidate keys, how would you implement it? A) EAV. (boo....

PHP/MYSQL Help - unexpected T_VARIABLE

Hi All, I am trying to make a edit profile page and i want the user to be able to change there username and email address. I've been going at this problem now for sometime and need your help. Parse error: syntax error, unexpected T_VARIABLE $edit = mysql_query("UPDATE users (Username, EmailAddress) VALUES('".$newusername."', '".$ne...

Updating a Database With PHP

Hi People, I'm trying to update my database records with the following code but am having no luck what so ever. Anybody care to help? Thanks <?php include "base.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> ...

SQL Server, not inserting records in correct position after deleting one or more records

I know, is a very basic question, but I am in the process of re-learning sql stored procedures, and this is what happended: I was practicing with some simple delete / insert routines, when encountered with this: if I ONLY insert records: 1. dog 2. cat 3. t-rex 4. llama all is ok, then I call a delete procedure, passing the colum...

SL app doesn't connect to Database from IIS, but does from VS2010 - SQL Server Auth, not Wndws Auth

I've made two small/test Silverlight apps with VS2010 (I am new to it), having same problem with both... When I run/debug it from within VS2010, the app runs and it connects to the database fine. But when I publish it to the IIS (on the same machine VS2010 is on), the app will run, but it will not connect to the database. I'm using SQL ...

Downloading and using a database from an untrusted source?

If I was to obtain a database (in this case for postgresql) from an untrusted source, is there any risk in activating it and querying it? ...

In SQL Server 2008, how should I copy data from database to another database?

I'm trying to write a stored procedure to copy a subset of data from one set of tables to an identical set of tables in a different database. The "source" database needs to be a parameter to the stored procedure. I've struggled with this for two days now, and I thought I had a good solution: Validate that the schemas are the same. Cr...

Password protect a page without db access with php

Is it possible to password protect a page without db access? I may have only few pages. But I should be able to change password and also save sessions etc. And I want a secure way as it's for production site! How is it to store in a config.php after md5: <?php username="admin"; password="1a1dc91c907325c69271ddf0c944bc72"; ?> If ...

I cant seem to find a pleasing answer for this on the web for this specfic question, "In MySQL do colums that have 'NULL' waste memory"?

Taken from one of my previous questions. Table is telling on which item (post , photo or reply) the comment is taking place on. commentid ---- postid ----- photoid-----replyid ----------------------------------------------- 1 22 NULL NULL 2 NULL 56 NULL 3 23...

Which databases can create function-based indexes?

I know, that this type of indexes exist in Oracle. Old versions on MySQL can not create function-based indexes (thanks, google). And new versions? How about PostgreSQL, SQL Server etc? ...

Using LIKE in CASE statements

Hi, how to use LIKE in CASE statement, i have got this example script but does not work. I use MS SQL 2008 DECLARE @DataBaseName sysname, @Message char(255) SET @DataBaseName = 'DBa'; SET @Message = CASE @DataBaseName WHEN LIKE 'DBa' THEN 'Valid name' ELSE 'INVALID name' END Print @Message; ...

pratical example of Postgres regex substring or regexp_matches

I have been trying to figure the following for a couple days. Please HELP PostgreSQL table : locations Id State -------------------- 1 New York 2 Texas input = 'Greetings from Texas to all Cowboys' output: row containing Texas SELECT id, state FROM locations WHERE state ~* substring(input from state) ...

What is the best practice to work in unmanaged programming pattern

I have a query UPDATE dbo.M_Room SET //do something WHERE PK_RoomId= @RoomId AND IsActive=1 AND FK_DepartmentId =@DepartmentId Now suppose PK_RoomId is my Pk of M_Room and is autoincremented field. So according to this I could have used WHERE PK_RoomId= @RoomId rather than WHERE PK_RoomId= @RoomId AND IsActive=1 AND FK_Departme...

ZF, How to generate Entities with Doctrine 2

Hello, I recently decided to try Doctrine 2. I manage to partially integrate it to Zend. The command line works and I manage to interrogate the database. The problem comes with the generation of my differents entities, proxies,... Before, with Doctrine 1.x, we could generate, start with our database, the YML files and business classes. ...

Writing test code for verifying database entries when testing an API

I'm writing test code to test a client-server application. The application under test consists of an application that runs on Tomcat or another Java EE application server, and client jars that expose an API. I'm basically writing test code that uses this client API to connect to the server. In addition to extensively testing the ...