database

How to model a many to many relationship?

With only a bit of previous experience with databases and no formal education with them, I'm a bit stuck as to how to model this (and retrieve the data I require from it in PHP). This is what I'm trying to model: For each item on my site, it is allowed to have multiple tags such as file, upload, php, recursive etc. However the tags are ...

having trouble with cakePHP Bake and one of the database tables

Hi, I am using Bake to create models for my database tables. I have run into a little problem. I have 25 tables .... I strated baking the models until for one of the database tables the bake started giving a name of it own to the model,file and class. For example ,the table in database is named : 'risk_manager' (It has association ...

How to do this: a=a+1 in sql server query ?

Hi, how I can do this: a=a+1 in sql server query? Thanks! ...

Using ADODBAPI-Python

Hi, Can you list some resources that explain using ADODBAPI in python.? ...

best desktop or webscript for managing database?

which one is best web script or preferably desktop software in which my small company can keep database of students and teachers and do stuff like sorting, filtering, and giving command to print certificate for selected students on demand. thanks ...

Any way to import multiple (csv) files to an Access db

I have multiple csv files with the same scheme, and I want to import them in one step. A solution could be to use the "import wizard", but I can only import one file with it. Oh, and it would be the best to work in msaccess2003. THX ...

asp.net mvc tutorial project

I'm having some trouble getting the code to work from the book "Pro ASP.NET MVC Framework." I'm on page 96 for those that may have worked through this book before. When I run the code I get the following: System.Data.SqlClient.SqlException was unhandled by user code Message="Invalid object name 'Products'." Source=".Net SqlClient ...

postgres: How to prevent INSERT in a special case

Hi there, I got a table 'foo' that looks like ID | NAME ------+---------------------------- 123 | PiratesAreCool 254 | NinjasAreCoolerThanPirates and a second table 'bar' SID | ID | created | dropped ------+------+------------+----------- 9871 | 123 | 03.24.2009 | 03.26.2009 9872 | 123 | 04.02.2009 | b...

What is the difference between ODBC and OleDB?

I found this question here: http://stackoverflow.com/questions/271504/oledb-v-s-odbc Which gave me more information, but did not really answer the question I'm asking, so I shall proceed from there. I am working in C#. I'll spare you the long story about how I arrived at this conundrum, but basically I'm trying to decide between ODBC ...

Database replication

OK when working with table creation, is it always assumed that creating a table on one database (the master) mean that the DBA should create the table on the slave as well? Also, if using a master/slave configuration, shouldn't data always be getting replicated from the master to the slave to synch? Right now the problem I am having is...

Efficiently record and store page view counts in the database?

Sites like StackOverflow count, save, and display the view counts for pages. How do you do it efficiently? Let's take view counts for StackOverflow questions as the example. I see the following options. Option 1. When the app receives a request for a question, increment the count in the question table. This is very inefficient! Th...

What's a "single sign on" table used for and why is this column list necessary?

I was looking at a schema and trying to figure out what this table could be used for: CREATE TABLE "single_sign_ons" "token" VARCHAR(64) NOT NULL, "ip" VARCHAR(32) NOT NULL, "expired_at" DATETIME NOT NULL, "one_time" VARCHAR(64), "created_at" DATETIME, "updated_at" DATETIME, "user_id" INTEGER, PRIMARY KEY("token")); What is "s...

Data migration with Hibernate

I am working on a project for a company, where I need to migrate its previous data into a new system. Obviously both structures are totally different and I'm using hibernate for database manipulation and confused as to what would be the best approach to migrate data. Should I use hibernate, should I write stored procedures, or is there a...

MySQL Insert in table if it doesn't exist already ¿Am I doing it right?

While building my application with relational tables I ran into the following problem : I have the following table, for this example named "valores": ----------------------- | id | value | ----------------------- | 1 | Unique VAL | | 2 | Unique VAL2 | ----------------------- ID = AUTOINCREMENT VALUE = UNIQUE What I...

Using multiple tables in MySQL and/or multiple columns for a Rails application

Hello, I'm wondering what the best practice is for having redundant columns in a MySQL database. I'm wondering this because I have a User table in my database but I also want to be able to display many statistics about each individual user. These stats might include how many times a user has interacted with another model or how many me...

Multiple SQL searches vs searching through one returned array

Is it faster to do multiple SQL finds on one table with different conditions or to get all the items from the table in an array and then separate them out that way? I realize I'm not explaining my question that well, so here is an example: I want to pull records on posts and display them in categories based on when they were posted, sa...

Verifying Full database backups "WITH CHECKSUM"

We have a daily maintenance plan in SQL Server 2005 that performs a full backup to disk using the "Back Up Database Task". "Verify backup integrity" is enabled but from what I understand data integrity is only validated if the backup media contains a checksum, which is enabled by the "WITH CHECKSUM" option during the backup. I can see ...

Is it posible to generate django models from the database?

I've been messing around with Django and the Django ORM at home, and I've got to say, I feel it is one of the best out there in terms of ease of use. However, I was wondering if it was possible to use it in "reverse". Basically what I would like to do is generate Django models from an existing database schema (from a project that do...

Escaping Characters Rails

I want to escape the inputs to this form so that when its enter in the database characters like .'* won't affect the update. How would I encode the characters to achieve the goal stated above. <% form_for @post, :url => {:action => :createInnovation } do |form| %> <fieldset> <p> Title: <br/><%= form.text_field :title, :html => {...

ActiveRecord Join table for legacy Database

I have a legacy database that I'm working on getting ActiveRecord to work with. I've run into a problem with join tables. I have the following: class TvShow < ActiveRecord::Base set_table_name "tvshow" set_primary_key "idShow" end class Episode < ActiveRecord::Base set_table_name "episode" set_primary_key "idEpisode" end ...