Thread: sql query help
View Single Post
Posts: 545 | Thanked: 560 times | Joined on Dec 2011 @ lebanon
#1
i need the following queries for this table
Code:
create table fabricant(
	numf	number(15),
	nomf	varchar2(15),
	adrf	varchar2(50),
	telf	number(15),
constraint fab_pk primary key (numf));

create table produit(
	nump	number(15),
	nomp	varchar2(15),
constraint prod_pk primary key (nump));

create table article(
	numserie	number(15),
	nump		number(15),
	numf		number(15),
	qte		number(20),
	prixfab		number(15),
	prixvente	number(15),
	check(prixvente <= 1.5 * prixfab),
constraint article_pk primary key (numserie),
constraint art_prod_fk	foreign key (nump) references produit (nump),
constraint art_fab_fk	foreign key (numf) references fabricant (numf));

create table client(
	numc	number(15),
	nomc	varchar2(15),
	adrc	varchar2(30),
	telc	number(15),
constraint client_pk primary key (numc));

create table commande(
	numcde	number(15),
	numc	number(15),
	datecde	date,
constraint cde_pk primary key (numcde),
constraint cde_client_fk foreign key (numc) references client (numc));

create table lignecde(
	numcde		number(15),
	numserie	number(15),
	qte		number(15),
constraint lcde_pk primary key (numcde,numserie));
the first is : "for each product get the manufacturer(fabricant) who supply the least expensive article "
and the second : "find Manufacturer List In which the total sales of the products is bigger than the average total sales of Manufacturers"