database

What are the pros and cons of the following database design?

I am looking to for suggestions and commments about the following design. All the tables are expected to be large tables (millions of records) and are updated and queried often and any kind of update is allowed (update, insert, delete). -- product create table Product( productID int not null identity(1,1), name varchar(100) not null, ...

Is this a good way to use mysql?

I am building a web app, and I am thinking about how I should build the database. The app will be feed by keywords, then it will retrieve info for those keywords and save it into the database with a datestamp. The info will be from different source like, num of results from yahoo, diggs from the last month that contains that keyword, et...

How to maintain an ordered table with Core Data (or SQL) with insertions/deletions?

This question is in the context of Core Data, but if I am not mistaken, it applies equally well to a more general SQL case. I want to maintain an ordered table using Core Data, with the possibility for the user to: reorder rows insert new lines anywhere delete any existing line What's the best data model to do that? I can see two wa...

How do you repeat a raw SQL query # times to MySQL?

I want to test the load a MySQL server can handle using a couple versions of a query and for that I'm looking for something like apachebench (but for mysql). I'm hoping to run 500 or more concurrent requests every second for a couple minutes and see if MySQL is up to the challenge. ...

Postgres: Find position of a specific row within a resultset?

Hello, I'm trying to figure out how to get the relative position of a single item in a query relative to all the items returned from the query. For example,the long hand way of getting the answer would be: single_item = SELECT * FROM table WHERE id=65 result = SELECT * FROM table WHERE published_date < date_value x=1 foreach(result as...

Should we put data in a database migration files?

Hi all, I have a question about database migrations files. Do you think they should only contain database structure changes? Or is it okay to have data inside them as well? What's the best practices? Personally I think database migrations files get ugly by putting data inside them. ...

Saving User Images

I am doing some weekend coding exercises. I have a table that contains some information about, say, a customer or user. Now I want to store images for this user. I have two choices: Save the image from user class to the same table that contains other user information. Save the image to a new table which I can create on separate filegro...

Create db from sql script in VS 2008

Hi, I have worked on Visual studio 2008 before, but do not have a lot of experience in working with databases. I have a Sql Script file which contains the complete information about the datanase that i am supposed to replicate and use in my project(which is a web site). Could someone guide me as to how am i supposed to use the Sql script...

How to store my data (C#.net)

I'm having a bit of a problem deciding how to store some data. To see it from a simple perspective, it will be a simple table of data but there will be many tables. There will be about 7 columns in each table, but again there will be a lot of tables (and they will be created at runtime, whenever the customer wants a clean grid) The data...

How to create tables, procedures, etc. on remote machine in sql server 2005/2008

Hi, I have prepared an installer which will deploy some files as well as will create database, tables, procedures, etc. The problem is if the user wants to install db, procs. on remote server then I require SQL client to be installed on machine from where I am installing my application. I dont want to have this (as clients would not ag...

Web stats: Calculating/estimating unique visitors for arbitary time intervals.

Hi, I am writing an application which is recording some 'basic' stats -- page views, and unique visitors. I don't like the idea of storing every single view, so have thought about storing totals with a hour/day resolution. For example, like this: Tuesday 500 views 200 unique visitors Wednesday 400 views 210 unique visitors Thur...

nested loop for retrieving specific row doesn't work

The below code doesn't work. The while loop doesn't display any values. If I change it to 0 and 150 it works fine. Please help me out here. Anything other than 0 doesn't retrieve any value. Using Oracle database. I tried using ORDER BY but it still doesn't work. ResultSet rset1 = stmt.executeQuery (" SELECT * FROM (SELECT * FROM iri...

Messaging Middleware Vs RPC and Distributed Databases

Hi All I would like to know your opinions on advantages and disadvantages of using Messaging Middleware Vs RPC and Distributed Databases in a distributed application? Thanks ...

symfony 1.4: adding defailt value to a model

I'd like to add some default values to a model when I'm creating a new entry (like a timestamp) I'm sure there are more than one way of doing this, I'm curious what the different ways are, but mostly what the standard way of doing this is. Thanks ---edit--- solution: for the timestamp the default would be default: CURRENT_TIMESTAM...

Entity Framwork 4.0 Relationship map table

I have these tables; Customer - CustomerID (primary key) - Name Car - CarID (primary key) - Model Customer_Car_Map (composite primary key CustomerID and CarID) - CustomerID (foreign key to Customer.CustomerID) - CarID (foreign key to Car.CarID) When I generate the models from the database using EF4, it generates classes for all tabl...

Recursive MySQL query

My database schema looks like this: Table t1: id valA valB Table t2: id valA valB What I want to do, is, for a given set of rows in one of these tables, find rows in both tables that have the same valA or valB (comparing valA with valA and valB with valB, not valA with valB). Then, I want to look for rows with...

What would it mean If I change the identifying relationship from this part of a database design to a non-identifying relationship?

Hi all, I have a question regarding with this database-design. I am a bit unsure of the difference between identifying and non-identifying relationships in a database leading me to some puzzles in my head. I have this database design: *(kind of like a movie rental stores. "friend" are those who borrow the movie. "studio" is the product...

MySQL Database synchronization

Is there any free MySQL synchronization tool out there? I need to synchronize the database structure across servers. Data synchronization is not necessary (but is a plus). It needs to be free (for non commercial use), not a free trial. Edit: None of the answers so far has worked, were free, or a suitable to my needs. ...

SQL Server 2005 Database Designer

Hello ! Does anyone know a good and free Database Designer able to export the design into SQL Server 2005 ? I have been using PowerAMC for 2 weeks but it was the trial. PowerAMC is the only program I know with a Conceptual Data Model Designer. Thank you. ...

Is it a bad idea to escape HTML before inserting into a database instead of upon output?

I've been working on a forum-like system, which does not allow for HTML formatting. The method I currently use is to escape HTML entities before they get inserted into the database. I've been told (in relation to XSS vulnerabilities) that I should insert the raw comment into the database, and escape HTML entities upon output. Other ques...