database

How are databases efficient?

If databases can support up to millions of records, how is all of this data organized such that queries can be executed in a reasonable amount of time? ...

Can I ask Postgresql to ignore errors within a transaction

I use Postgresql with the PostGIS extensions for ad-hoc spatial analysis. I generally construct and issue SQL queries by hand from within psql. I always wrap an analysis session within a transaction, so if I issue a destructive query I can roll it back. However, when I issue a query that contains an error, it cancels the transaction. ...

What database table structure should I use for versions, codebases, deployables?

I'm having doubts about my table structure, and I wonder if there is a better approach. I've got a little database for version control repositories (e.g. SVN), the packages (e.g. Linux RPMs) built therefrom, and the versions (e.g. 1.2.3-4) thereof. A given repository might produce no packages, or several, but if there are more than one...

Best Practices for Sanitizing SQL inputs Using JavaScript?

So, with HTML5 giving us local SQL databases on the client side, if you want to write a select or insert, you no longer have the ability to sanitize third party input by saying $buddski = mysql_real_escape_string($tuddski) because the PHP parser and MySQL bridge are far away. It's a whole new world of SQLite where you compose your querie...

extract android 1.6 calendar fields to vcal

Hi, I want to extract android 1.6 calendar fields and put them into a vcalendar file my problem is that i can't find some fields in the database like: DTSTAMP UID LAST-MODIFIED SEQUENCE does anyone have a clue on how to find them? thanks! ...

Where/when does the object impedence mismatch occur?

When people talk about object impedence mismatch, where does the mismatch happen? What can't a database interpret from an object model? Thanks ...

Asp.net mvc small amount data storage

Hi there, I am writing some learning tests (i.e. what's the answer for...; choose correct options...). Now my question is, how should I store them. SQL db seems quite an overkill, but I really don't know what would be the best choice if I wanted to select random subset of questions etc. Perhaps some simple xml files? Thanks for advice. ...

Query has no destination for result data after Trigger

Hello, i have a problem with me trigger. Every time i insert a new line i will check if the article not sold. I can do it in the software but i think its better when the DB this does. -- Create function CREATE OR REPLACE FUNCTION checkSold() RETURNS TRIGGER AS $checkSold$ BEGIN SELECT offer_id FROM offer WHERE offer_id = NE...

relational databases and multicast messages

I have read that relational databases are a terrible way to do multicast messages like twitter. So twitter saves every tweet only one times and then retrieve its in every stream ? or saves every tweet in every users's stream ? I want to know why relational database ( like mysql or postgresql ) doesn't good for twitter-like application....

what is the output of this code?

Hi,I have wriiten a part of code for you and I want to know the output ,I need your help because there is not any body for helping me also I think that the out put is A ,is this correct? thanks. declare @v1 varchar(20),@v2 varchar(20) select @v1 = 'NULL' if @v1 is null and @v2 is null select 'A' else select 'B' EDITED: also what is th...

Create MySQL user and database from PHP

Hi, Is there a way to create a new MySQL database, a new MySQL user and give the new user privileges on the new database all using PHP? EDIT - should be pointed out this is run from 1 server to another, so Server A trying to install a DB/user on Server B i've got this: $con = mysql_connect("REMOTE.IP.ADDRESS","root","pass"); mysql_qu...

How can I treat a sequence value like a generated key?

Here is my situation and my constraints: I am using Java 5, JDBC, and DB2 9.5 My database table contains a BIGINT value which represents the primary key. For various reasons that are too complicated to go into here, the way I insert records into the table is by executing an insert against a VIEW; an INSTEAD OF trigger retrieves the NE...

explain these select statements!

Hi, I can not get the difference betwwn these statements? would you please help me,I have read some sample of select statements but I did not get these ones. SELECT 'B' FROM T WHERE A = (SELECT NULL); SELECT 'C' FROM T WHERE A = ANY (SELECT NULL); SELECT 'D' FROM T WHERE A = A; I use MySQL EDITED: also it has a conditional part t...

Which is better H2 or HSQLDB?

HSQLDB 2.0 is soon to be released. I wonder if it will outperform H2 since, as far as I know, most users prefer H2 than HSQLDB. I am interested in the MVCC support of HSQLDB 2.0. I have learned that MVCC on H2 is still experimental. With regards to support/documentation, concurrency, performance, which is better between the two? ...

null value for all rows of a column!

Hi Is there any way for setting all the rows of a column to a null value? thanks ...

"=null" and select statement!

I have asked this question before in this forum and they told me that it will return an empty result set. I want to know that if I set the column with null values, will it also return an empty result set? (Note: ANSI_NULLS is OFF) SELECT 'A' FROM T WHERE A = NULL; Also this is an example that I find confusing: DECLARE @val CHAR(4) SE...

what's wrong with this code?

Hi this is my code which will not work correctly ! what is wrong with its data type :( thanks CREATE TABLE T1 (A INTEGER NOT NULL); CREATE TABLE T3 (A SMALLINT NOT NULL); INSERT T1 VALUES (32768.5); SELECT * FROM T1; INSERT T3 SELECT * FROM T1; SELECT * FROM T3; ...

something about ansi_nulls

Hi I have a question that we always say that null =null is false ,I want to know that when the ansi_nulls is off this statement which is "null=null" is also false? thanks ...

Database solution for 200million writes/day, monthly summarization queries

Hello. I'm looking for help deciding on which database system to use. (I've been googling and reading for the past few hours; it now seems worthwhile to ask for help from someone with firsthand knowledge.) I need to log around 200 million rows (or more) per 8 hour workday to a database, then perform weekly/monthly/yearly summary queri...

How do I efficiently write a "toggle database value" function in AJAX?

Say I have a website which shows the user ten images and asks them to categorise each image by clicking on buttons. A button for "funny", a button for "scary", a button for "pretty" and so on. These buttons aren't exclusive. A picture can be both funny and scary. The user clicks the "funny" button. An AJAX request is sent off to the dat...