PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > Table Schema
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Table Schema

Réponse
 
LinkBack Outils de la discussion
Vieux 24/03/2008, 06h35   #1
Carmen Sei
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Table Schema

I have a group of TV listing data need to map into database tables.

Data looks like following:
http://www.oniva.com/upload/1356/crew.jpg

I want to create a table for productionCrew of each TV program

the data is like -
crew -> programID -> member
-> member
-> member ... etc
-> programID -> member
-> member
-> member ... etc
-> programID -> member
-> member
-> member ... etc
... etc

above are data from productionCrew of all TV program, for each
programID we have a list of members.

Should I merge all member into a big string?
Or should I use 2 tables to store the Crew data?

If i use 2 tables, how the fields / column will look like?
  Réponse avec citation
Vieux 24/03/2008, 11h34   #2
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Table Schema

Carmen Sei (fatwallet951@yahoo.com) writes:
> I have a group of TV listing data need to map into database tables.
>
> Data looks like following:
> http://www.oniva.com/upload/1356/crew.jpg
>
> I want to create a table for productionCrew of each TV program
>
> the data is like -
> crew -> programID -> member
> -> member
> -> member ... etc
> -> programID -> member
> -> member
> -> member ... etc
> -> programID -> member
> -> member
> -> member ... etc
> ... etc
>
> above are data from productionCrew of all TV program, for each
> programID we have a list of members.
>
> Should I merge all member into a big string?


Absolutely not.

> Or should I use 2 tables to store the Crew data?
>
> If i use 2 tables, how the fields / column will look like?


I would guess that you need at least three tables, since I suspect that
a person can be member of more than one crew.

That gives:

CREATE TABLE programs (programid int NOT NULL PRIMARY KEY,
programname nvarchar(200) NOT NULL,
... )

CREATE TABLE people (personid int NOT NULL PRIMARY KEY,
firstname nvarchar(50) NOT NULL,
lastname nvarchar(50) NOT NULL,
....)

CREATE TABLE productioncrew (programid int NOT NULL REFERENCES programs,
personid int NOT NULL REFERENCES people,
role datatype? NOT NULL,
PRIMARY KEY (programid, personid))

As for the role I don't have knowledge enough to know how this should
be handled. It seems reasonable that a person can participates in
different roles in different crews, so it should not be an attribute of
the person. (Then again, a person has a certain skill set, which may want
to record.) A person can also have several roles in the same crew,
which would call for even more relational tables, but depending on the
need to query that information it may shoot over the target to have
such tables.

The important thing is that in a relational database, a basic rules is:
no repeating groups. Repeating groups are difficult to query and
maintain.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
  Réponse avec citation
Vieux 24/03/2008, 23h56   #3
Carmen Sei
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Table Schema

I think i only need 2 table is enough

CREATE TABLE programs
(
programid int NOT NULL PRIMARY KEY,
programname nvarchar(200) NOT NULL,
... )

CREATE TABLE productioncrew
(
programid int NOT NULL REFERENCES programs,
firstname nvarchar(200) NOT NULL,
lastname nvarchar(200) NOT NULL,
role nvarchar(200) NOT NULL,
PRIMARY KEY (programid, firstname, lastname, role)
)

since my DB is only 6 tables like Schedules, TVStations,
ChannelLineup, Programs, ProductionCrews and Genres

it's a very small DB and I dont' need all those ID things it's easy to
do query with above

>
> CREATE TABLE programs (programid int NOT NULL PRIMARY KEY,
> programname nvarchar(200) NOT NULL,
> ... )
>
> CREATE TABLE people (personid int NOT NULL PRIMARY KEY,
> firstname nvarchar(50) NOT NULL,
> lastname nvarchar(50) NOT NULL,
> ....)
>
> CREATE TABLE productioncrew (programid int NOT NULL REFERENCES programs,
> personid int NOT NULL REFERENCES people,
> role datatype? NOT NULL,
> PRIMARY KEY (programid, personid))
>
>As for the role I don't have knowledge enough to know how this should
>be handled. It seems reasonable that a person can participates in
>different roles in different crews, so it should not be an attribute of
>the person. (Then again, a person has a certain skill set, which may want
>to record.) A person can also have several roles in the same crew,
>which would call for even more relational tables, but depending on the
>need to query that information it may shoot over the target to have
>such tables.
>
>The important thing is that in a relational database, a basic rules is:
>no repeating groups. Repeating groups are difficult to query and
>maintain.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h10.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11905 seconds with 11 queries