database

Best way of designing the flow of code when reading/writing from database

So I'm trying out a concept tool of mine where I need to be able to read and write data from a database real easy. I've set up the form as I like and spread around different text boxes and dropdownboxes to read the data from the database. And I've got it all to work and all, but there's a small bug I don't fully understand why's there. S...

Concurrency violation: the UpdateCommand affected 0 of the expected 1 records

Hi, I've got a simple mdb database set up in Visual Basic Express Edition (winforms) and I'm trying to update data from a datagridview to a database. I've databinded the textboxes to the columns I want in the datagridview and this works great. After some struggling, I've finally managed to have the values updated in every row of the da...

suggested database schema for photos website

i am trying to organize my photos and create some ajax front end. I have lots of photos and an existing hosting site that is paid for that has lots of disk space so i dont want to pay to store on picasa web or alternative. I am creating an asp.net site to view these photos but i an trying to determine best schema to store then. A have...

DB design for multiple types of entities

I need to develop an application where there will be 4 types of user entities (administrators, partners, companies and clients), each user type has it's own set of details and they all should be able to do common operations like send messages, make payments and so on. These operations should be kept on a single table but they need to ref...

Composite primary key question in MySQL

I am a newbie to databases. I am using MySQL, and I have a table A using three attributes to form a composite primary key: A: [key1, key2, key3], dateCreated, createdBy, ... Now I have another table B, which needs to refer to records from the table above. Now, reusing all the three attributes above again to form a key seems to be a pai...

Joomla include database functions

Hello. I'm using Joomla 1.5. I have created a custom component that pulls data out of the database perfectly. I initialize the database in my main component file like this: $db =& JFactory::getDBO(); The problem is that I have a jQuery autocomplete plugin on my component page that makes calls to a PHP file from my component folder. Th...

iPhone Networking

If I have make an application, how would I make it interact with a database on a server of mine? I'm kind of lost, and don't know where to start. ...

Database structure for items with varying attributes

Hello there. I am developing a clothes web application and would appreciate advice on how to structure the data in my mysql database. Every product (item of clothing) will be photograped in a number of ways, let's call them 'modes'. For example a shirt would be photographed buttoned or unbuttoned, and/or tucked in/not tucked in. A pa...

CrunchBase-like system

What's the best platform for creating a CrunchBase like system? (has to be open source). Thanks! ...

History tables pros, cons and gotchas - using triggers, sproc or at application level.

I am currently playing around with the idea of having history tables for some of my tables in my database. Basically I have the main table and a copy of that table with a modified date and an action column to store what action was preformed eg Update,Delete and Insert. So far I can think of three different places that you can do the hi...

When do triggers fire and when don't they.

Pretty general question regarding triggers in SQL server 2005. In what situations are table triggers fired and what situations aren't they? Any code examples to demonstrate would be great. I'm writing a audit based databases and just want to be aware of any situations that might not fire off the triggers that I have set up for update,...

mysql query help?

I have a table with 'id' as the primary field and set to auto increment.. 'name' of type varchar .. 'category' of type varchar .. Table contents ::. * id=1,name=abc,category=tv * id=2,name=abc,category=radio * id=3,name=abc,category=tv * id=4,name=abc,category=radio * id=5,name=abc,category=tv * id=6,name=abc,category=tv Now, I want to...

What do Clustered and Non clustered index actually mean?

I have a limited exposure to DB and have only used DB as an application programmer. I want to know about Clustered and Non clustered indexes. I googled and what I found was : A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one cluster...

Correct normalization of database with optional columns

I need to create a database table that stores parametric descriptions of physiological characteristics (e.g. systolic blood pressure, triglyceride concentrations, etc.) of a hypothetical cohort of patients. For example, supposing the user specifies a triangular distribution for SBP, then the minimum, maximum and mode (and distribution t...

How to handle a few dozen flags in a database

Like most apps, mine has a "users" table that describes the entities that can log in to it. It has info like their alias, their email address, their salted password hashes, and all the usual candidates. However, as my app has grown, I've needed more and more special case "flags" that I've generally just stuck in the users table. Stuff...

Need help with my query

Hi. Sorry for the horrible title, not sure how to explain this. I have a query that looks like this: SELECT `name`, `latitude`, `longitude`, `indoor`, `address`, `phone`, `email`, `website`, `closed` FROM rocks INNER JOIN (SELECT DISTINCT id FROM rock_types WHERE type="DWS" or type="Top rope") AS types ON rocks.id=types.id ...

SQLite - ORDER BY RAND()

In MySQL I can use the RAND() function, is there any alternative in SQLite 3? ...

Can't see the I've installed Visual Studio Team System 2008 Database Edition Power Tools but can't see Checksum Unit Tests

I've installed the Visual Studio Team System 2008 Database Edition Power Tools but can't see Unit Tests Conditions ChecksumCondition & ExpectedSchemaTestCondition I believe that it installed OK & I can see the new refactor commands so at least a part of it worked. Is there something I need to do to get the 2 new test conditions to disp...

Null value return problem

I wanted to check my monthly payroll in which there are employee salary along with other detail. I have created a PL/SQL block but when I place my condition for checking of existing employee id with another table some return null value and hence my table does not go further. set serveroutput on declare emp_id NUMBER :=&emp; temp N...

Does MYSQL stores it in an optimal way it if the same string is stored in multiple rows?

I have a table where one of the columns is a sort of id string used to group several rows from the table. Let's say the column name is "map" and one of the values for map is e.g. "walmart". The column has an index on it, because I use to it filter those rows which belong to a certain map. I have lots of such maps and I don't know how mu...