Aid sur une requete
Fermé
yuri648
Messages postés
677
Date d'inscription
mardi 30 décembre 2008
Statut
Membre
Dernière intervention
20 mai 2015
-
4 juin 2009 à 01:50
yuri648 Messages postés 677 Date d'inscription mardi 30 décembre 2008 Statut Membre Dernière intervention 20 mai 2015 - 4 juin 2009 à 23:19
yuri648 Messages postés 677 Date d'inscription mardi 30 décembre 2008 Statut Membre Dernière intervention 20 mai 2015 - 4 juin 2009 à 23:19
A voir également:
- Aid sur une requete
- Graphql server responded with error 1675030: erreur lors de l’envoi de la requête. - Forum Facebook
- Requête sql pix - Forum Python
- Erreur de requete facebook rencontre - Forum Facebook
- Requête sql doublons sur 2 champs ✓ - Forum Programmation
- Registry first aid - Télécharger - Optimisation
10 réponses
snake-d12
Messages postés
218
Date d'inscription
mardi 2 juin 2009
Statut
Membre
Dernière intervention
25 septembre 2009
57
4 juin 2009 à 02:20
4 juin 2009 à 02:20
pouvez vous nous expliquer les relations entre ces tables
redlifebig
Messages postés
59
Date d'inscription
jeudi 5 juin 2008
Statut
Membre
Dernière intervention
17 mars 2010
23
4 juin 2009 à 02:32
4 juin 2009 à 02:32
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")
yuri648
Messages postés
677
Date d'inscription
mardi 30 décembre 2008
Statut
Membre
Dernière intervention
20 mai 2015
7
4 juin 2009 à 09:50
4 juin 2009 à 09:50
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.
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.
yuri648
Messages postés
677
Date d'inscription
mardi 30 décembre 2008
Statut
Membre
Dernière intervention
20 mai 2015
7
4 juin 2009 à 10:02
4 juin 2009 à 10:02
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
merci
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
redlifebig
Messages postés
59
Date d'inscription
jeudi 5 juin 2008
Statut
Membre
Dernière intervention
17 mars 2010
23
4 juin 2009 à 14:30
4 juin 2009 à 14:30
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
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
yuri648
Messages postés
677
Date d'inscription
mardi 30 décembre 2008
Statut
Membre
Dernière intervention
20 mai 2015
7
4 juin 2009 à 17:09
4 juin 2009 à 17:09
vous pouvez essayer la requete ici
https://www.sql-ex.ru/exercises.php?N=11
merci
https://www.sql-ex.ru/exercises.php?N=11
merci
redlifebig
Messages postés
59
Date d'inscription
jeudi 5 juin 2008
Statut
Membre
Dernière intervention
17 mars 2010
23
4 juin 2009 à 22:22
4 juin 2009 à 22:22
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
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
yuri648
Messages postés
677
Date d'inscription
mardi 30 décembre 2008
Statut
Membre
Dernière intervention
20 mai 2015
7
4 juin 2009 à 22:34
4 juin 2009 à 22:34
meme je me suis douter du site qu'il marche pas bien
en tout cas j'ai compris le principe et merci bcp
en tout cas j'ai compris le principe et merci bcp
redlifebig
Messages postés
59
Date d'inscription
jeudi 5 juin 2008
Statut
Membre
Dernière intervention
17 mars 2010
23
4 juin 2009 à 22:47
4 juin 2009 à 22:47
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
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
yuri648
Messages postés
677
Date d'inscription
mardi 30 décembre 2008
Statut
Membre
Dernière intervention
20 mai 2015
7
4 juin 2009 à 23:19
4 juin 2009 à 23:19
elle a marché 100% merci
4 juin 2009 à 02:25