database

select statement get time duration

let say i have table look like below actionTable ----------- id, user, actionName, time 1 , userX, startdoing, 1/1/2010 9am 2, userX, endDoing, 2/1/2010 10am may i know whether possible to use 1 sql select statement to minute record 2 from 1 and get time spent ? or use hibernate.criteria to do this? ...

Problem regarding c#.net application communication with MySql

I am Developing a Desktop Application with c# .net and MySql as Database. It's an encryption application which produces an exe file which communicates with MySql to bring some data. I am using the MySql.Data.dll for application communication with MySql. When it produces exe there is no MySql.data.dll with it so it throws an error: Coul...

Is a varchar 2 more efficient than a varchar 255?

I'm using Django and setting my CharField(max_length=255), even though I only intend to use about 5 characters. Is this less efficient? I've read that it doesn't really matter with varchar but then read that it'll save hard drive space to specify only what you need. ...

How to create MySQL back up executable file?

I am using php, mysql and my server is Windows Server 2003 with IIS6. I am planning to backup my database on hourly basis. I can do the cronjob, tested by write date&time into a log file. It works perfectly. Now I want to use the cronjob to backup my databases. How do I do that? Create a php script and let it run every hour?? ...

sql optimize search many-many

usertable ---- id, username grouptable ---- id, groupname group_user -------- uid, gid books ---- id, groupname Input parameters: groupname, username output: list of books Is it possible to use 1 sql statement to get list of books when username is inside groupname Question 2: any good book to recommand to master complex sql st...

How to create an insert Form with TextInput containing ComboBox provided by mySQL Database Table

I have a Flex application which manage a database composed by 7 tables. I have created the insert form and all work great. Now I wanto to improve the Form performances; the idea is to replace the TextInput of the Form with ComboBoxes which are provided by the DataBase tables. Any ideas? Thanks in Advance ...

DROP SQL Tables if created date is more than a week - MS SQL Server

Hi, I want to create a Stored procedure and Job in Ms SQL server that would delete all tables in a schema that are more than a weeks old. i create backups every single day and i want to automate the process by scheduling a job to delete any backups(SQL Tables) that are older than a week. Your help would be greatly appreciated. ...

Multiple one to many relationships using the same 2 tables in ruby on rails?

I have a database with 2 tables; Users and Revisions. Revisions has multiple one-to-many relationships to the users table, for example created_by, verified_by, published_by (each field being a foreign key user id). How would I go about defining this relationship in my Rails models? ...

How to define a column that can automate capitalizing?

So that when you insert 'abc',it'll be converted to 'ABC' automatically. I'm using MySQL,is it possible? ...

Toggle results from a database

Hi, I'm pretty new to jQuery, php and Databases, but i managed to create a database en retrieve data with php from that database. After a searchterm is filled in, The data (retrieved from the database) will be displayed in the resultpage. For example: when searching for Netherlands you will get a couple of cities as a result. These ci...

Postgres: clear entire database before re-creating / re-populating from bash script

hi folks, I'm writing a shell script (will become a cronjob) that will: 1: dump my production database 2: import the dump into my development database Between step 1 and 2, I need to clear the development database (drop all tables?). How is this best accomplished from a shell script? So far, it looks like this: #!/bin/bash time=`dat...

How to design Automation framework for a database

Recently I faced an interview question, "If there is a database having many stored procedures and functions, then how would you design and develop a framework for automation testing?" How would you answer that question? ...

In mysql how do I find rows repeating with respect to all fields ?

+------------+------------+ | student | department | +------------+------------+ | 1234567890 | CS | | 1234567890 | ME | | 1234567890 | CS | | 000000001 | ME | +------------+------------+ How can I get rows that are repeating with respect to both fields? Thanks in advance. ...

What will be the best way to keep track of modified tuples in a database?

I am currently working on a project in which I have to keep track of the tuples that are modified in a relational database. This should include updated tuples, but also inserted and deleted tuples. My question is what will be the best way to accomplish this? I have several ideas of my own, but maybe there are easier/better ways that I di...

How often should I close database connections?

Currently, I'm opening a database connection in my app's initialization. It's a fairly small app, PHP if that's relevant. Should I be connecting to the database, making calls, then closing and repeating this process for each database function I write? For example, I have the following function which grabs the $db variable from my app's...

Database design: why use an autoincremental field as primary key?

Hi, here is my question: why should I use autoincremental fields as primary keys on my tables instead of something like UUID values? What are the main advantages of one over another? What are the problems and strengths of them? ...

Is there a Tool to View Disk Usage on a Team Foundation Server DB

We have a TFS installation on a machine that is close to going out of support life and we're planning on migrating to a new machine in a couple of months. However in the meantime we are getting really low on disk space and (for whatever reason) we can't add more disk space. This has me wondering if there is a tool that would show us ho...

How to structure database for relational? data

I need to keep track of points scored and who they are scored against. Previously, I did this using a flat file database (that was a mess) that looked like this: 03611100025 00001000000 21011000000 00003000000 00021000000 10001050000 00001402000 00001000100 00001013050 00001000100 00001000000 Each team got a row and a column, and I gu...

In mysql How can I multiply two tables?

Basically what I want is cross product of two tables. t1 is : +------------+ | student | +------------+ | 1234567890 | | 1234567890 | | 1234567890 | | 000000001 | +------------+ t2 is: +--------+ | number | +--------+ | 1 | | 3 | +--------+ How can I get a tab...

AMF Channel without Livecycle, BlazeDS or similar

Is it possible to use an AMF Channel in a Flex HTTPService client application without using Adobe Livecycle, BlazeDs or similar in order to do real time asynchronous request from an HTTPService? ...