Aid sur une requete

Bonjour,

je ne sai pas comment faire cette requete

-Find all the makers who have all their models of PC type in the PC table.

voila le model relationnel

Product(maker, model, type)

PC(code, model, speed, ram, hd, cd, price)

Laptop(code, model, speed, ram, hd, screen, price)

Printer(code, model, color, type, price)

et merci d'avence
Configuration: Windows XP
Firefox 3.5

10 réponses

  • Votes
  • Date
  • Date décroissante
  1. pouvez vous nous expliquer les relations entre ces tables
    1. je pense que les relation sont claire!!!!!!! juste voir les proprité doublant dans chaque une des tables
  2. select product.maker from product where maker not in (select product.maker from product where product.model not in (select pc.model from pc) and type="pc")
    1. voila quelque explication:

      The table "Product" includes information about the maker, model number, and type ('PC', 'Laptop', or 'Printer'). It is assumed that model numbers in the Product table are unique for all the makers and product types. Each PC uniquely specifying by a code in the table "PC" is characterized by model (foreign key referencing to Product table), speed (of the processor in MHz), total amount of RAM - ram (in Mb), hard disk drive capacity - hd (in Gb), CD ROM speed - cd (for example, '4x'), and the price. The table "Laptop" is similar to that one of PCs except for the CD ROM speed, which is replaced by the screen size - screen (in inches). For each printer in the table "Printer" it is told whether the printer is color or not (color attribute is 'y' for color printers; otherwise it is 'n'), printer type (laser, jet, or matrix), and the price.
      1. la requete que vous m'avez donné Mr redlifebig elle me revois les maker qui 'ont au moin un pc dans la tables pc je l'ai essayé sur la console ;
        merci
        1. Bonjour

          dans la requête que je t'ai donné
          SR1:(select product.maker from product where product.model not in (select pc.model from pc) and type="pc")
          nous renvoie tous les product maker qui on au moin un pc qui n'est pas dans la table pc après je fais
          Select product.maker from product where maker not in SR1
          donc les maker qui on tous les pc dans la table PC verifie de nouveau n'oublie pas NOT IN
          1. Bonjour

            moi j'execute la requet sur une table mysql voici le schema
            /*Table structure for table `pc` */

            DROP TABLE IF EXISTS `pc`;

            CREATE TABLE `pc` (
            `code` varchar(50) default NULL,
            `model` varchar(50) default NULL
            ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

            /*Data for the table `pc` */

            insert into `pc`(`code`,`model`) values ('1','a');

            /*Table structure for table `product` */

            DROP TABLE IF EXISTS `product`;

            CREATE TABLE `product` (
            `maker` varchar(20) default NULL,
            `model` varchar(20) default NULL,
            `type` varchar(20) default NULL
            ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

            /*Data for the table `product` */

            insert into `product`(`maker`,`model`,`type`) values ('g','a','PC'),('g','z','Laptop'),('g','b','PC'),('f','a','PC');

            et voici la requete
            Select distinct product.maker from product where maker not in (select product.maker from product where product.model not in (select pc.model from pc) and type='PC')

            ça marche, maintenant que ça marche pas sur le site je ne sais pas pourquoi

            Cordialement
            1. meme je me suis douter du site qu'il marche pas bien
              en tout cas j'ai compris le principe et merci bcp
              1. dsl

                j'ai trouvé l'erreur
                Select distinct product.maker from product where maker not in (select product.maker from product where product.model not in (select pc.model from pc) and type='PC') and product.type='PC'

                il falait ajouter le test ='PC' a la fin c tous