database

SQL Retrieving the last record in a sql query

I need to retrieve the last record in a mysql database table - is there a command for this? ...

MySQL: Join two tables with different number of rows and one same column name

Hi, i have two tables "*TABLE_A*" and "*TABLE_B*", and i want to connect them the same way like in "*RESULT_TABLE*". TABLE_A: +-----------+-----------+---------+ | row_id | category | val_1 | +-----------+-----------+---------+ | 1067 | cat1 | 6.5 | | 2666 | test | 6.5 | | 2710 | cat1 | 2.1...

SQL best practice to deal with default sort order

A lot of SQL code I've read, it seems like the developer assumes that the default sort order always hold. For example when building an HTML select list they would just SELECT id, name FROM table without issuing an ORDER BY clause. From my own experience it seems like dbms alway order data using FIFO if no ORDER BY clause is given and n...

Using JNDI for Database connections

This might sound like a noob question but this is the first time I'm treading into Database territory. From here I got the info that The most efficient way to implement communication between the server and database is to set up a database connection pool. Creating a new connection for each client request can be very time-c...

How can I connect to a web based Oracle database with Java?

I have an account, password and the URL. ...

MySQL Query Browser Multiple Statements

So, I'm using MySQL Query Browser to connect to a remote mysql server and trying to execute multiple statements. But it appears to only execute one statement at a time. For instance, it looks like the query browser is only executing a highlighted line and none of the other statements. Is there any way to execute all the statements in a t...

postgresql execParams paramTypes meaning?

I'm trying to perform an insert (C++) using different datatypes using execParams, but it keeps saying that the insert is failing. I believe this is because It's interpreting all my datatypes as text because I've set paramTypes to NULL. The documentation says If parameters are used, they are referred to in the command string as $1...

Big tables and analysis in MySql

For my startup, I track everything myself rather than rely on google analytics. This is nice because I can actually have ips and user ids and everything. This worked well until my tracking table rose about 2 million rows. The table is called acts, and records: ip url note account_id ...where available. Now, trying to do something ...

User-generated database entries in rails

I am trying to do something in Rails and will admit that I'm no genius programmer, but I'm attempting to learn. I want to create a database with user-generated entries of no specific number. The best example of what I am trying to do can be illustrated by twitter. I assume every time the user adds a new tweet it adds a row to the use...

SQL Date Format

How do I format a data in SQL to read like this: Monday, November, 23 2009 ...

How atomic is the Berkeley DB usage?

I am writing a simple app with 24 items in a hash to be persistent across program executions, so Berkeley DB (DBM) should be well suited for this task. And it is just for fun. But I wonder if using it (with Ruby), then when the user presses CTRL-C, then the execution is stopped. In this case, can't the data be all messed up? For exa...

Constraints instead Triggers (Specific question)

I read here some reasons to use constraints instead of triggers. But I have a doubt. How can be assure (using only constraints), the coherence between SUPERCLASS tables and SUBCLASSES tables? Whit a trigger is only a matter of check when INS.. UPD... Is there a way to define that kinda relation by using only constraints (I'm newbie at ...

List of Cities by Country

Where does Facebook get their list of cities from? Is there a service that provides an up-to-date feed of cities based on country? ...

Where clause variable for linqtosql from IDs in Stored Procedures.

Hi, I have created a function that retrieves values based on datepart of a datefield from a stored procedure: public List<spDB1GetIDsByTimeResult> GetIDsByTime(int timePart) { using (DB1DataContext db1= new DB1DataContext ()) { List<spDB1GetIDsByTimeResult> query = db1.spDBGetIDsByTime(timePart).ToList()...

Are Database operations thread safe?

Hi, I am using sqlite in my iPhone app. I have some database operations, in which I have to insert into two tables different data(means there is no data-dependency). Can I perform these two operations in seperate thread. While the insert operation in each table are more than one. So I am doing this in a while loop also. ...

Create a Database in C#

I have a project I need to do in C#, in this project I have to create a database which can add rows automatically, perform queries, and present the data from the DB in a table. Does anybody have any idea how can I do that easily? (what kind of DB to use, or a guids that can guide me during the programming). Because I google it, but I ...

Can DbParameter instance of same name and type be shared with multiple DbCommand instances?

Is it efficient or possible to share same DbParameter object with multiple commands? ...

DB2 override auto generated key when inserting

Hi, I want to insert an item to a table in the database. The table has a key that is auto generated. Is it possible to override the auto generated key, (force a value). If so how? ...

Advantages and disadvantages of Ruby on Rails polymorphic relationships.

What advantages and disadvantages do you know of Ruby on Rails polymorphic relationships. ...

How Should I Implement a Huge but Simple Indexed StringList in Delphi?

I am using Delphi 2009. I have a very simple data structure, with 2 fields: A string that is the key field I need to retrieve by and is usually 4 to 15 characters in length. A string that is the data field that may be any size, from 1 character up to say 10,000 characters. The difficulty is that I may have several million of these re...