database

pubs database documentation

Hello all, is there a documentation of the pubs database (it comes as a demo DB for SQL 2000)? for example, what is the roysched table? what represents lowqty and hightqty and discount columns from the discount table? minlvl and maxlvl from jobs table? Thanks ...

View over multiple tables containing same columns

I have four tables containing exactly the same columns, and want to create a view over all four so I can query them together. Is this possible? (for tedious reasons I cannot/am not permitted to combine them, which would make this irrelevant!) ...

Is there any library/framework for undo/redo changes of rows in database ?

May be my title is not clear. I am looking for some kind of version control on database tables, like subversion does on files, like wiki does. I want to trace the changes log. I want to extract and run the diff in reverse. (undo like a "svn merge -r 101:100"). I may need a indexed search on the history. I've read the "Design Pattern fo...

Large data - storage and query

We have a huge data of about 300 million records, which will get updated every 3-6 months.We need to query this data(continously, real time) to get some information.What are the options - a RDBMS(mysql) , or some other option like Hadoop.Which will be better? ...

SQL Server 2005 trigger - how to safely determine if fired by UPDATE or DELETE?

I have the following code in a SQL Server 2005 trigger: CREATE TRIGGER [myTrigger] ON [myTable] FOR UPDATE,DELETE AS BEGIN DECLARE @OperationType VARCHAR(6) IF EXISTS(SELECT 1 FROM INSERTED) BEGIN SET @OperationType='Update' END ELSE BEGIN SET @OperationType='Delete' END My question: is there a situation in which @Operation...

Are Object oriented databases still in use?

Quite a while ago, I heard about Object databases. Cool concept and all. Now, with the event of ORMs everywhere, does anyone still use any of the Object oriented Databases systems? Are they relevant? Are they practical? ...

Conflicting CASCADE and RESTRICT foreign key requirements?

I'm working on a database that tracks files and dependencies in projects. Briefly, I have two main tables; the PROJECTS table lists project names and other properties, the FILES table lists files. Every file entry points to a project as a foreign key set to CASCADE, so if I delete a project record from the database, all the file records ...

Combining UNION ALL and ORDER BY in Firebird

This is my first attempt at answering my own question, since someone may well run into this and so it might be of help. Using Firebird, I want to combine the results of two queries using UNION ALL, then sort the resulting output on a given column. Something like: (select C1, C2, C3 from T1) union all (select C1, C2, C3 from T2) order b...

20 Billion Rows/Month - Hbase / Hive / Greenplum / What ?

Hi, I'd like to use your wisdom for picking up the right solution for a data-warehouse system. Here are some details to better understand the problem: Data is organized in a star schema structure with one BIG fact and ~15 dimensions. 20B fact rows per month 10 dimensions with hundred rows (somewhat hierarchy) 5 dimensions with ...

Common mySQL fields and their appropriate data types

I am setting up a very small mySQL database that stores, first name, last name, email and phone number and am struggling to find the 'perfect' datatype for each field. I know there is no such thing as a perfect answer, but there must be some sort of common convention for commonly used fields such as these. For instance, I have determined...

Where can I find a Good Sample ASP.NET Database Driven Web Application?

I would like to learn the best practices to employ when creating a database driven web-application. I prefer to learn from examples. What is a good sample application that I can download and run to learn this: I am looking for: Should be written in C# (preferably) Should contain a complex database design (parent child relations, etc....

Using a DetailsView in ASP.Net when using an ObjectDataSource or a SqlDataSource

How do you use a DetailsView control in Asp.NET? How do you change the labels to something other than the database field name? How do you hide some of the fields from the user? (which you need to query for because they are the identity fields - row-id, which you dont want the user to see)? ...

DetailsView and Parent-Child tables - inserting rows

When you have parent-child tables and you wish to use a DetailsView to edit the data how do you do it using a SqlDataSource? For example, if you have a Person and an Employee table (where an employee is the child table and the Person is parent table - an employee derives from a person). Person P_ID FirstName LastName DOB Employee E...

Why doesn't the SQL standard provide a way of specifying FDs other than superkeys?

It seems to me there are other functional dependencies you may wish to declare (other than superkeys of course), but SQL provides no easy way to do so. Why is this? ...

How do you create optional associations in Linq-To-Sql classes?

I am trying to creating an optional association between a couple of tables. I have one table called Invoice. The Invoice table has a FK reference to the Customer table through the CustomerId field. The Invoice table also has a not enforced FK reference to the Project able through the ProjectId field. Is there anyway to set up my Linq...

Hierarchical Data Structure Design (Nested Sets)

Hi, I'm working on a design for a hierarchical database structure which models a catalogue containing products (this is similar to this question). The database platform is SQL Server 2005 and the catalogue is quite large (750,000 products, 8,500 catalogue sections over 4 levels) but is relatively static (reloaded once a day) and so we a...

How to check a procedure/view/table exists or not before dropping it in db2 9.1?

How do we write below pseudo code in db2, If (Proc exists) Drop Proc Create Proc Else Create Proc One solution I found, after googling is to ignore the return codes. Do we have a more elegant way to do this? Thanks Update: With the help of the answer below we wrote a proc as below to drop the procedures CREATE PROCEDURE SV...

Writing data into a database using a fully REST web service

How would one create a REST web service to write a row into a databse table. Use the follwoing scenario: The table is called Customer - the data to be inserted into the row would be the name, addresss, telephone number, email. I think its impossible to describe the whole thing end to end in Java or C#, and I would never expec...

How good are Redgate's SQL tools?

I'd like to hear from anyone who has experience with Redgate's tools for Sql Server 2005. In particular, are their backups 100% reliable? Their claims about backup speed and compression sound almost too good to be true. For those who have used Redgate's backup, do they handle transaction log backups (and therefore restoring up to a sp...

PHP - Query single value per iteration or fetch all at start and retrieve from array?

I have a function that looks something like this: //iteration over scales foreach ($surveyScales as $scale) { $surveyItems = $scale->findDependentRowset('SurveyItems'); //nested iteration over items in scale foreach ($surveyItems as $item) { //retrieve a single value from a result table and do some stuff ...