Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id F19D59F9687 for ; Tue, 28 Aug 2007 08:47:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 84261-08 for ; Tue, 28 Aug 2007 08:47:47 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.236]) by postgresql.org (Postfix) with ESMTP id 773199F9661 for ; Tue, 28 Aug 2007 08:47:47 -0300 (ADT) Received: by nz-out-0506.google.com with SMTP id l8so1205970nzf for ; Tue, 28 Aug 2007 04:47:46 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=SQYkO4FHRArp59Lt+O9QT0b7ozgF7v/uXTPw1ee+Z58DPaHhbDKdtc67bG7zMklxCqoTKcuydNYsk6Km3VTRnvJZm4iB+yluEy6Zo2fbApGTPVYPyN8O3dbnpW7/AJcYoc2ggyWvNXiWn9OwXiaGcluEotxJmu6nUnaP6wyzbRI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=lyDcSPh1zN/3EfrAGNXVyfMABbqgA076i3/oWHOAa4TBg6Q0bNcpxovaIfHUSoNrJNaIsgtOW/h74TzXbtNpGCpgOzubS0dIUFeAP+Xlm9VHNSK/aeavxrY/g8KNMIsQryqU7jAW+6KFepdPT+Xq6GtU0HW97A3mV2hWA7UB92w= Received: by 10.141.76.21 with SMTP id d21mr404064rvl.1188301665401; Tue, 28 Aug 2007 04:47:45 -0700 (PDT) Received: by 10.141.40.8 with HTTP; Tue, 28 Aug 2007 04:47:45 -0700 (PDT) Message-ID: <99b656cb0708280447x4eb7c45axec01c8d0ebc6c82d@mail.gmail.com> Date: Tue, 28 Aug 2007 12:47:45 +0100 From: "Sebastian Ritter" To: pgsql-sql@postgresql.org Subject: Re: Database normalization In-Reply-To: <99b656cb0708210709j5182b73cna63a2d275efa0e84@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_28982_15224010.1188301665367" References: <99b656cb0708210709j5182b73cna63a2d275efa0e84@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/234 X-Sequence-Number: 29172 ------=_Part_28982_15224010.1188301665367 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, > > I have a fairly basic question about database design where im not sure > which approach is considered correct. > > I have two different entities: Clients and Services. Both allow users to > add progressive updates about the two entities. > > The update/message format is exactly the same for both. Should I make two > different tables: > > client_updates and service_updates > or > one table with extra columns : is_client, client_id, service_id, where > either client_id or service_id would be null depending on the is_client > boolean? > > The major problem is simply relating the foreign key in the updates table > back to the correct entity, client or service. > > Regards, > Sebastian > > ------=_Part_28982_15224010.1188301665367 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello,

I have a fairly basic question about database design where im not sure which approach is considered correct.

I have two different entities: Clients and Services. Both allow users to add progressive updates about the two entities.

The update/message format is exactly the same for both. Should I make two different tables:

  client_updates and service_updates
  or
  one table with extra columns : is_client, client_id, service_id, where either client_id or service_id would be null depending on the is_client boolean?

The major problem is simply relating the foreign key in the updates table back to the correct entity, client or service.

Regards,
Sebastian


------=_Part_28982_15224010.1188301665367--