database

Auto increment a non-primary key field in Ruby on Rails

In a RoR migration, how do I auto increment a non-primary-key field? I'd like to do this in the db definition, and not in the model. ...

query for substring formation

I want to take the 01 part of a string abcd_01 using SQL. What should be the query for this, where the length before the _ varies? That is, it may be abcde_01 or ab_01. Basically, I want part after the _. Thanks. ...

Django. Update data in db. Easy question.

Ok! I have this model: class my(models.Model): name = models.TextField() description = models.TextField() created = models.DateTimeField() def __unicode__(self): return self.name I'm gettin data to this model from mssql database and saving it. Something like this. mysql_name='somedata' #this data come...

loading large tables of students, but school only identified on first line

Hi -- I'm loading large text file of high school students into MySQL, but the school itself is only identified in the first line of each text file. Like so: 897781234Metropolitan High 340098 1001X 678 AS Reading 101KAS DOE KEITH A1 340089 A 7782... Using SQL code, how can I generate a col...

Database migration through php

I have a mysql database that I am trying to migrate into another database. THey have different schema's and I have written a php script for each table of the old database in order to populate its data in to the new one. The script works just fine but the problem is that it does not move all the data. for example if I have a table and all...

What's the best way to dump a MYSQL table to CSV?

Possible Duplicate: Dump a mysql database to a plaintext (CSV) backup from the command line. I prefer python, but if mysqldump works...then how can I do that? ...

Autovacuum - database

Does anyone know what autovacuum means in the sense of databases? ...

General guidelines for developing a web application

As a programmer used to developing native applications, I'm expanding my horizons and developing my first web app. I'm intermediate to expert with Linux and C, intermediate with Python and HTML and beginner to intermediate with MySQL and Java. I'm developing a web app that is more or less a resource allocator for a friend of mine. To pu...

Setting up Membership/Login using Visual Web Developer & ASP.NET

Hey All, I'm following this tutorial: http://msdn.microsoft.com/en-au/library/879kf95c.aspx And there seems to be a lot of information missing. It doesn't tell me how to upload the database to my server etc. I remember following this tutorial last year, and ran into numerous propblems, and a google search revealed THOUSANDS of people ...

How to Connect Python to MySQL DataBase ... ?!

Hi All, A question about connecting Python To MySQL DB: How Can I Do That ?! Link, If You Have References or ... ...

Database: Multiple tables or just one table?

For example I have photos and videos tables, I can comment on these, but when I send it to database which way is better? To have 2 tables for comments: photo_comments and video_comments Or to have 1 table comments and create a row inside the table like type and put there if it's a photo_comment or video_comment I think the 1 is faste...

best way to store options in a db

Hi there, i have a table and one of the columns is co_com this is communication preferences there are three options (and only ever will be) i dont want to have a seperate column for these values so i was thinking of storing them as sms/email/fax sms = yes email = no fax = yes which would be stored as: 101 but, im thinking thats no...

Alternative in using Excel in reporting.

Even with the advanced technologies and available database tools (even free alternatives) are available today, it seems that huge number of users are still very comfortable in using Excel IN EVERYTHING! That's why, as a database developer working as one of these users, I am forced to let them use Excel simply because they are very comfor...

C# URL Routing Issue

So I have an interesting problem here. I am using URL Routing to mask the URL but I want to take the spaces out. For example: /sanjuan/ but in the database it's San Juan. An error is thrown when I type it in because clearly theres a space in the DB. I don't want it conjoined in the DB though. How can I accomplish this. I just need som...

How to quickly prune large tables?

I currently have a MySQL table of about 20 million rows, and I'm in an urgent need to prune it. I'd like to remove every row whose updateTime (timestamp of insertion) was more than one month ago. I have not personally performed any alterations of the table's order, so the data should be in the order in which it was inserted, and there is...

Are sessions faster than querying the database?

So for example, the user is logging in, and the system is storing informations about them example: birth date, so is faster to get this information from the session, or to query the database for it? My idea was, that the user needs to login just once and the session is always there, but If I query the database, then if the user reloads...

Database design for storing food recipes

I want to make a database of recipes that I like, but I'm having trouble designing it. I want to have at least two tables: Recipe table (Has description, ingredients, directions, etc...) Ingredients table (ingredient type, other attributes, etc...) What would be a way to associate a the two tables together? Would I need a third table...

Cost of too much database access.

Hi! I'm wondering if my idea is possible*. I'm doing a project on road networks and I plan to do many database access; meaning, for example, to check if one route is connected to another route, check database if connection exist? I have predefined information about the routes so I want to use them as mush as possible, but I'm worried tha...

Literature about Database performance

Good morning, I am at the moment writing my master thesis and hence I have to justify each an every general assessment I make. I have a flat database in MySQL which was originally composed of the following fields Date (DATETIME) Name (VARCHAR(50)) Value (DOUBLE) The PK of the table was a composite of the columns 1 and 2. The thing...

.NET - Strategy for multi database support

Our current web application is using SQL Server, we have a requirement for support Oracle now. There are a few options: Data Facade pattern: use Data Facade interface in Business Layer, so SQL Server and Oracle can have their own implementation of Data Access Layer. The problem is it's hard to synchronize DAL code for different type o...