database

Database query time complexity

I'm pretty new to databases, so forgive me if this is a silly question. In modern databases, if I use an index to access a row, I believe this will be O(1) complexity. But if I do a query to select another column, will it be O(1) or O(n)? Does the database have to iterate through all the rows, or does it build a sorted list for each col...

ASP.NET MVC "Stock Application" Deployment Issue

I am starting to learn ASP.NET MVC. I have deployed the "stock" ASP.NET MVC Sample Application (i.e. the simple user account system) to have a live version to test against when I start to play. Note that I'm using: - ASP.NET MVC 1.0 release. - WebFusion Host. I think the issue is to do with accessing the database. I deployed usin...

Database Structures with a Large Number of Bit Fields

I have a class of data with a very large number of binary properties--151 (!) to be exact--and I am concerned with how to model this data structurally. Despite the internal efficiencies of storing bit-fields as bytes, my programming spidey senses are tingling at creating a table with 151 bit-fields (in addition to other properties). The...

SQL: Counting number of occurances over multiple columns in Oracle

Cannot get my head around the SQL that will return the number of times a user has accessed a particular service. Think it might require a nested count and select, but cannot get my head around it. The data looks like this: UserID Service --------------- 1 Map1 1 Map2 1 Map1 2 Map1 2 Map2 3 Map4 3 ...

Creating a connection with remote database using Cocoa

How can I access a MS Access database from a remote server, which is on Windows platform, using Cocoa and objective-C on Mac OS X? The server is located in remote location and it can only be accessed over internet. How can I make connection with server over internet? what all procedures to be used for making such applications? If I need...

Prepare Database For SQL Server Clustering

we are planning to implement sql server 2005 cluster in next few months. i wanted to know what steps / precautions need to be taken as a database developer when trying to achieve this? do we need to change any ado.net code (in front end) / stored procs etc etc? are there any best practices to be followed? reason i am asking this questio...

Problem In updating a database through windows application.

Hi all.. I have a question. I am having problems updating data in an SQL database with Windows Forms (Visual Studio project). Here is what I do: I get user information in text boxes. I edit some of them. I do 1 back n get to this form again. The info is updated. When I quit and login again, it shows me the old data! It seems as ...

Updating backend database from cooked XML/PDF input: Which is the best tool/approach?

We have to automate database updation couple of times a month. My current use case is as follows. Currently we manually diff the input data with the previous month's input. If it is XML we use MS xmldiff. If it is Pdf , it is fully done through manual verificaton :-( . Once the changes are found, we update the database through a fo...

Best .NET3.5 based strategy for creating disconnected db application.

Hi group: My requirements are: Relatively small database: 25-30 tables with 4-5k rows in each. 4-5 users with their own copies of local database on their laptops. Sync when needed or at the end of the day. Free solution, as am making this setup for a NFP ogranization. I have been researching various options in last few days. At last I ...

How to determine if a date range occurs any time within another date range?

I have an Event table that specifies a date range with start_date and end_date fields. I have another date range, specified in code, that defines the current week as 'week_start' and 'week_end'. I'd like to query all Events for the week. The cases seem to be: Event begins and ends within the week Event begins before the week, but en...

What changes do I need for my tables to work on AppEngine's BigTable?

Let's say I have a booking database consisting of users: user_id fname lname and their tickets ticket_id user_id flight_no and associated flights flight_no airline departure_time arrival_time What would I need to change to move this Google AppEngine? I understand AppEngine doesn't allow joins. Does that mean my table should be...

Database Schema question

Hello all, I am having a difficult time deciding how to handle a business requirement in my database schema. I have a lot of tables in the database, but there are only three I need to deal with for this problem: Courses, PersonnelCourses, and Personnel. Courses is a list of Courses Personel is a list of Personnel PersonnelCourses is...

Need some suggestion for a database schema design

I'm designing a very simple (in terms of functionality) but difficult (in terms of scalability) system where users can message each other. Think of it as a very simple chatting service. A user can insert a message through a php page. The message is short and has a recipient name. On another php page, the user can view all the messages ...

Format data, before or after inserting into database?

I can never decide if it's better to format data before inserting it into the DB, or when pulling it out. I'm not talking about data sanitization; we all know to protect against SQL injection. I'm talking about if the user gives you a URL, and it doesn't have http:// in front of it, should you add that before inserting it into the DB or...

Idempotent PostgreSQL DDL scripts

Hi, I'm looking for a way to script postgreSQL schema changes in an idempotent manner. In MSSQL I could do something like this: if(not exists(select * from information_schema.columns where table_name = 'x' and column_name = 'y')) begin alter table x add y int end go PostgreSQL doesn't seem to allow ad-hoc pl/pgsql in the same wa...

How to get rid of multiple columns in a database?

I'm creating an Access DB for use in an C# application at school. I've not had much experience working with DB's so if this sounds stupid just ignore it. I want the user to be able to select all the classes that a certain student has had in our IT department. We have about 30 in all and the maximum that a person can take in 4 years of hi...

A lot of writes,but few reads - what Mysql storage engine to use?

I was wondering if anyone has a suggestion for what kind of storage engine to use. The programs needs to perform a lot of writes to database but very few reads. [edit] No foreign keys necessary. The data is simple, but it needs to preform the writes very fast. ...

How might I insert an array of data into a database table?

I am developing an attendance management program, used to maintain the absence record of a student. Users of this software will need to enter various dates, updated once in a month: for instance, a list of dates on which a student was absent for that particular month would be entered, and my program must then store them into a database w...

When creating a social voting system, should you keep track of downvotes and upvotes separately in the DB?

With things like SO, Digg, Reddit, etc... Should one keep track of downvotes in the database independent of upvotes? Or should they simply have a "votes" field that is decremented/incremented based off what the user does with no persisting of that? How should votes be handled? ...

Best-practices for processing errors from database in codeigniter

I have a table with a unique key (date + userid) in my webapp database. When i try to insert record with existing date and userid, i'm getting error "dupicate key in table". I turn on database debug in application config, because i need use mysql error number and message. And now i need processing this error. I can use hard coded constan...