database

Should I use Primary key here?

As an example, I have a 3 tables: School: ID int, Name varchar Student: ID int, Name varchar StudentInSchool: StudentID int, SchoolID int Now the question is whether I should put a column ID int with a primary key on it in StudentInSchool table? If yes, why? Will it be helpful in indexing? Any help appreciated. ...

How to validate Hibernate mapping against database

How to check that Hibernate mapping configuration matches database? I'd like know if I am using wrong version of hibernate mapping before I start executing update and queries, which then would fail. I have bunch of classes that have been mapped with Hibernate annotations. I also have connection to corresponding database. Now I'd like to...

SQL: Using NULL values vs. default values

What are the pros and cons of using NULL values in SQL as opposed to default values? PS. Many similar questions has been asked on here but none answer my question. ...

WCF Service for many concurrent clients and database access

I'm new to WCF services and wondered what the best way to tackle the following would be. I have many clients (~200 - ~500) that are all making requests of my service fairly constantly during the working day. Most requests involve interrogation of an underlying database to feed the correct response back. What I'm concerned with is the p...

ASP.NET Session State Service in Sql Server but w3wp.exe #private increasing

I have recently moved our ASP.NET session state from InProc to a Sql Server solution. I can see session data being inserted into the Sql Server database. I'm monitoring the w3wp.exe process using the "Private bytes" & "# Bytes in all heaps" performance counters. As I navigate through the website it places data into session, however the ...

What are the advantages of using a schema-free database like MongoDB compared to a relational database?

I'm used to using relational databases like MySQL or PostgreSQL, and combined with MVC frameworks such as Symfony, RoR or Django, and I think it works great. But lately I've heard a lot about MongoDB which is a non-relational database, or, to quote the official definition, a scalable, high-performance, open source, schema-free, do...

Set of Foreign Keys Where All But One Are NULL

What is the name for the technique of using a set of foreign keys in a table where all but one are NULL for a given row? In other words, each row needs a foreign key to one (and only one) of n different possible tables so you actually have all the necessary foreign keys but all but one are NULL. (users of Django may recognize this as a...

Difference between types of database projects in Visual Studio

In Visual Studio 2008 I have 2 types of database projects: C# -> Database -> SQL Server Project Other project Types -> Database -> Database Project What is the difference between these 2? Is there any reason to use one over ther other? ...

How to empty a SQL database?

Hello, I'm searching for a simple way to delete all data from a database and keep the structure (table, relationship, etc...). I using postgreSQL but I think, if there a command to do that, it's not specific to postgres. Thanks, Damien ...

SQL Associative Entity question

Hello, I have a SQL question. I'm working with the following set of tables: http://imgur.com/eg19r.png The Recipe table contains 5 recipes, Ingredient contains many ingredients (52), and IngredientList is an associative entity, an implementation of the many-to-many relationship between Recipe and Ingredient. RecipeID and IngredientI...

Switching Database in LinqToSql

How can we change the underlying database for Linq based WebApp ? for example: When we release our web application, say to release from production, if using ADO.NET, it is as simple as modifying connection string in web.config to point towards the live Database in use. The databases are almost identical, other data stored.. What and h...

What is better: to have many similar databases or one database with similar tables or one database with one table?

I need to work with several data samples, to say, N. The samples represent similar data but from different origins. For example, history of order in different shops. So the structure of all the samples is the same. To operate with the data I have several possibilities: Use N databases with identical schema, one for each sample Use one ...

[iPhone] release NSData in NSManagedObject

Hi, I use datamodel to store 2 objects : Video, Images. Video contain just string attributes and Images have 2 "Binary data" attributes. At the start the 2 binary data attributes was in the video object. But all videos are loading during initialization of UITableView. For 400 videos binary data represent 20 Mo, so imagine with 4000 vid...

Questions every good Database/SQL developer should be able to answer

I was going through Questions every good .Net developer should be able to answer and was highly impressed with the content and approach of this question and so in the same spirit, I am asking this question for Database/SQL Developer. What questions do you think should a good Database/SQL programmer be able to respond to? EDIT : I am ma...

Blackberry BES Trancoders database access

Is that possible that transcoders working under BES server can have access to external database? ...

Manage database connection using connection pool or session. How?

I have a simple task to accomplish, but I am not sure what is the best way to go by. Each user has their own username and password to connect to a database with different privilege. Once the user connect, he will do multiple query base on what action he want to perform. Therefore I want to retain the connection with the database. So h...

Which database is generally recognized as the big boy on the block for enterprises?

I have experience with various versions of SQL Server and Oracle and my general sense is that, deserving or not, Oracle probably has a better reputation for being the preferred database although I sense MS has been closing ground for some time and sometimes even claiming that it outperforms Oracle in situations x,y, and whatever, a close...

How to filter posts with multiple category names in WordPress?

I am trying to work around a plugin for Word Press called "Event Calendar 3". This plugin lets you create events and then feeds them into a SQL table in the Wordpress database. However, this plugin does not discriminate between different types of events, eg repeating events, one-off events. The beginning of my solution was to create a c...

Transactions in Castle ActiveRecord + NHibernate for dummies

I would like to do the following, all in a single atomic transaction: Read an object through ActiveRecord Save a new object through ActiveRecord Update another table via NHibernate Also, if by the time I finish the transaction, the value of the object I've read in step 1 has changed, I would like the transaction to fail. I've never ...

creating multiple tables with single sql command

I searched for this here and on google and surprisingly couldn't find an answer. I tried to create syntax to submit to mysql that would create multiple tables with the same columns, but it returned an error. Can you point out what is wrong with my syntax, or if this is even possible? CREATE TABLE news, life ( id int PRIMARY KEY AUTO_...