database

Unique constraint on more than 10 columns

I have a time-series simulation model which has more than 10 input variables. The number of distinct simulation instances would be more than 1 million, and each simulation instance generates a few output rows every day. To save the simulation result in a relational database, i designed tables like this. create table SimulationModel ...

How can I manage a FIFO-queue in an database with SQL?

I have two tables in my database, one for In and one for Out. They have two columns, Quantity and Price. How can I write a SQL-query that selects the correct price? In example: If I have 3 items in for 75 and then 3 items in for 80. Then I have two out for 75, and the third out should be for 75 (X) and the fourth out should be for 80 (Y...

How to query on table returned by Stored procedure within a procedure.

I have a stored procedure that is performing some ddl dml operations. It retrieves a data after processing data from CTE and cross apply and other such complex things. Now this returns me a 4 tables which gets binded to various sources at frontend. Now I want to use one of the table to further processing so as to get more usefull inform...

Reported error code considered SQL Injection?

SQL injection that actually runs a SQL command is one thing. But injecting data that doesn't actually run a harmful query but that might tell you something valuable about the database, is that considered SQL injection? Or is it just used as part to construct a valid SQL injection? An example could be set rs = conn.execute("select headl...

Create database programatically from PHP on WHM/cPanel server

Hi everyone, I was wondering whether it is possible to create a new database and user, from PHP, on an WHM/cPanel server. Thanks in advance for your answers, Constantin TOVISI ...

DB optimization to use it as a queue

We have a table called worktable which has some columns(key (primary key), ptime, aname, status, content). We have something called producer which puts in rows in this table and we have consumer which does an order-by on the key column and fetches the first row which has status 'pending'. The consumer does some processing on this row: ...

Compress and Decompress - columnar database

Hi, I am developing a columnar database. I want to made my database do expand and compress based on which columns ares most accessed. Example, if i have a table with 5 columns like, name, state, coutry, age, profession and I see that most of the queries are based on state and name, I would like to store this columns In a uncompressed wa...

Should I sanitize EVERY form variable passed along?

I have a form with many fields... The action is set to a php page which queries mysql... Should I sanitize with mysql_real_escape_string every single variable? Or can I ignore sanitizing drop-lists and radios for instance? Also, besides mysql_real_escape_string, what else should I do to prevent attacks? Thanks ...

how to display table data more clearly. in oracle sqlplus

Here is the way sqlplus displays my table data: but I want to show them as Name | Address | -------+---------------+ name1 | address1 | name2 | address2 | name3 | address3 | ...

Select which satisfies at least N conditions from M available.

Hi, there is a question floated. It's set in basic SQL terms, but its nature is pure math (so maybe I should visit http://mathoverflow.com too). I have a table in some theoretical database with 6 fields, all are numbers. Also we have basic conditions, such as Field_1 > Field_5, Field_4 = 3 etc., 7 conditions total. I need to write a sel...

database encryption questions

We are using Sybase SQL Anywhere 11. We need to encrypt some of our tables in our database. I followed the instruction and did it. We selected the "strong" option with encryptionKey and AES256_FIPS algorithm. But there are something I am not clear about them. It will require encryptonKey when we create the database, remove the database...

.tpl files and website problem

Apologies if the title is in lowercase but it's describing an extension format. I've started using Dwoo as my template engine for PHP, and am not sure how to convert my PHP files into .tpl templates. My site is similar to, but not the same as, http://library.digiguide.com/lib/programme/Medium-319648/Drama/ with its design (except colou...

User Database Script for iPhone API interaction

Is there any kind of PHP script that has a user database with custom tables that I can access through a RESTful API? I am wanting to create an iPhone app that interacts with the user database.. such as register, login, update info... Any ideas? Thanks! ...

Database Schema Managing Framework/Library

I'm looking for any database framework/library for .net which will act as a unified layer between an application and databases. Please note that I'm not interested in querying/updating data (there is plenty of DALs for that) but rather a framework which allows me to manage table schemas and indexes in a managed fashion (without using dat...

DB design for master file in enterprise software

Dear all. I want to write an enterprise software and now I'm in the DB design phase. The software will have some master data such as Suppliers, Customers, Inventories, Bankers... I considering 2 options: Put each of these on one separate table. The advantage: the table will have all necessary information for that kind of master file ...

Get current updated column name to use in a trigger

Is there a way to actually get the column name that was updated in order to use it in a trigger? Basically I'm trying to have an audit trail whenever a user inserts or updates a table (in this case it has to do with a Contact table) CREATE TRIGGER `after_update_contact` AFTER UPDATE ON `contact` FOR EACH ROW BEGIN INSER...

Generating text file from database

I have a requirement to hand-code an text file from data residing in a SQL table. Just wondering if there are any best practices here. Should I write it as an XMLDocument first and transform using XSL or just use Streamwriter and skip transformation altogether? The generated text file will be in EDIFACT format, so layout is very speci...

What database is a good progression from MS Access for Coldfusion?

All my (home) CF learning has so far been done using Access as a database, and as far as the DB goes I "get it". There's no database server, and no need to log on to the database or anything, and setting up table relationships is easy and visual. Oh and its essentially free to deploy. However, I'm now working on an application that's li...

How to programatically create a database from an ADO.Net Entity Model?

I am using .Net Framework 4.0. I have an entity model (.edmx) and I have a menu option in my program for connecting to an existing database or creating a new one. When the user selects to create a new database, I want to generate the database and schema from the entity model. Any idea how to do so? ...

A software/hardware structure of the Google Search/Maps Linux-clusters ?

I am particularly interested how one can deal with a huge amount of information for a commercial service like Google Search or Google Maps. We all know they use (or "did" at least) a kind of Linux clusters, but how exactly are they organized? What kind of hardware do they use, what file systems, networking, what problems are the most fre...