database

Store pictures as files or in the database for a web app?

My question is fairly generic and I know there might not be an 100% answer to it. I'm building an ASP .NET web solution that will include a lot of pictures and hopefully a fair amount of traffic. I do really want to achieve performance. Should I save the pictures in the Database or on the File system? And regardless the answer I'm more ...

Managing Recurrent Calendaring Data

I am having to build a web app that has an event calendar section. Like in Outlook, the requirement is that users can set up recurrent events, and can move individual events around within a series of events. What methods could one use to store (in a database) the various ways you can describe the recurrence pattern of a series? How wou...

Owner ID type database fields

Suppose you have these tables: RestaurantChains, Restaurants, MenuItems - with the obvious relations between them. Now, you have tables Comments and Ratings, which store the customer comments/ratings about chains, restaurants and menu items. What would be the best way to link these tables? The obvious solutions could be: Use columns O...

ASP.NET Access Database Error?

I have written some code that uses an Access DB, on my localhost the following - Select, Insert, and Delete queries work just fine and do what I programmed them to do. When I move the application to the staging server, the application throws errors when Inserting and deleting, however the select statements work just fine. I have made sur...

Search for all occurrences of a string in a mysql database.

I'm trying to figure out how to locate all occurrences of a url in a database. I want to search all tables and all fields. But I have no idea where to start or if it's even possible. ...

Best practices for multithreaded processing of database records

I have a single process that queries a table for records where PROCESS_IND = 'N', does some processing, and then updates the PROCESS_IND to 'Y'. I'd like to allow for multiple instances of this process to run, but don't know what the best practices are for avoiding concurrency problems. Where should I start? ...

Default size for database fields

What the size that you use for common database fields, like firstName, lastName, Email, password, etc? I see these common fields in a lot of databases of blogs, forums, e-commerces, etc. But I don't know if there is some reference or default for the size for that common fields. So, I want to know what the method/reference/basis that you ...

What are the best practices for functional programming and database interaction?

I know that in pure object-oriented languages like Java it usually makes sense to use ORMs like Hibernate. But what would I do when writing a CRUD-type functionality in Clojure or Common LISP? Passing around SQL as the first-order functions? But isn't having SQL in HTML-generating code very ugly? Thanks, Olek ...

Should I use a number or an email id to identify a user on website?

I have a web app where I register users based on their email id. From a design/ease of use/flexibility point of view, should I assign a unique number to each user or identify user based on emailid? Advantage of assigning unique number: I can change the login itself at a later point without losing the data of the user(flexible). Dis...

How to create JavaScript form & User specific action?

I'm looking for help on how to code the following: I want to create a pop-up or Javascript item that allows users to accept the terms of completing an offer for me. Once they have accepted the terms, I would like that offer that they agreed to do to go under the account in a section or tabled labeled "Offers". Please advise on how to c...

Which book do would you recommend for learning the basics of DataWarehousing

Best book on DWH/BI -Primer ...

Is it possible to automate SQL Server 2008 profiler?

There was a post regarding useful SQL tricks. Here I was going to mention the SQL Server Profiler tool, as it has helped me write less SQL. I would write SQL that would interrogate, understand or second guess the databases business logic. Profiler is very useful, especially where application code has embedded SQL and you want to work ...

What is the difference between Unique Key and Index with IsUnique=Yes?

I have a table with a primary key, but I want two other columns to be constrained so the combination of the two is guaranteed always to be unique. (a dumb example: In a BOOKS table, the IBAN column is the primary key, but the combination of the Title and Author columns should also always be unique.) In the SQL Server Management Studio ...

Join two sql queries

I have two SQL queries, where the first one is: select Activity, SUM(Amount) as "Total Amount 2009" from Activities, Incomes where Activities.UnitName = ? AND Incomes.ActivityId = Activities.ActivityID GROUP BY Activity ORDER BY Activity; and the second one is: select Activity, SUM(Amount) as "Total Amount 2008" from Activities...

Check if exists within SQL CASE statement

I am trying to update a column in table a based on whether a different column in the table is in a set of results from table b. Currently variations on: update a set a.field1 = case when exists ( select b.field2 from b where b.field2 = a.field2 ) then 'FOO' else 'BAR' end are not running. Any ideas how to do this for a ...

What is your favorite cross-platform solution to access multiple different databases (MySQL, Oracle...) in C/C++?

I am writing a simple C++ application which might be installed on Linux or Windows, and which will connect to a database. I want my application to be compatible at least with Oracle and MySQL (or PostgreSQL). Which C or C++ library would you recommend to handle the database queries: I am open to any library, whether it's very thin (jus...

Best way to create a unique number for each many to many relationship

I have a table of Students and a table of Courses that are connected through an intermediate table to create a many-to-many relationship (ie. a student can enroll in multiple courses and a course can have multiple students). The problem is that the client wants a unique student ID per course. For example: rowid Course Student ID (c...

Continuous database backups?

I have the following scenario: Our system is running a SQL Server Express 2005 database locally (on each users desktop, if you will). The system is storing a lot of production data from a machine. There are high demands on the safety of the data, and doing a backup each night, or even each hour is not enough. We need a backup strategy t...

Generate a number of ranges for a random set of values

Given a set of random numeric values in a database, how do I generate a limited list of ranges where each range contains at least one value? The ranges should not overlap and ideally have a similar amount of values in them. Ideally their boundaries should also be multiples of 10, 100, 1000 etc... For example: Values: 100,150,180,300,40...

Is it bad practice to "go deep" with your application of callbacks?

Weird question, but I'm not sure if it's anti-pattern or not. Say I have a web app that will be rendering 1000 records to an html table. The typical approach I've seen is to send a query down to the database, translate the records in some way to some abstract state (be it an array, or a object, etc) and place the translated records ...