Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Letters should be found in a string - what is the best?
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00428574
Message ID:
00429030
Vues:
18
This message has been marked as a message which has helped to the initial question of the thread.
Hi!

>Hi Andrew,
>
>If you can explain your first idea more detailed, it would be great.

Nadya, it looks like you don't know RDBMS theory well ;) Sorry, just kidding. I will try to explaing it by easy way.

In RDBMS theory many-to-many relationship should be established by using separate additional table to preserve third normal form of database. For example:

Customer
Cust_id name address

Product
prod_id name description

Many-to-many relationship will be done using third table

CustProd
Cust_id Prod_id date_bought


As you see, this way allows also add some additional information. You way will look here like following:

Customer
Cust_id name address mapto='A8', 'BCD' etc.

Product
prod_id = 'A', '8', 'B' etc.

Do you see difference?

Anyway, seems you will not accept such database changes because you already have a lot of data, as you said. In addition, third notmal form for Many-to-many relationship is good for flexibility, but bad for queries. Your query in such case for 'AND' will look like following:

Select * from Customers
Where cust_id IN (select cp.cust_id from CustProd cp inner join products p
on p.prod_id = cp.prod_id where prod_id = 'A')
AND cust_id IN (select cp.cust_id from CustProd cp inner join products p
on p.prod_id = cp.prod_id where prod_id = '8')

Nice, heh? I don;t know about speed, however. Last query definitely will run more quickly on SQL server, but will be slower with VFP database through network because plenty of indexes for optimization.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform