لسلام عليكم
اصدقائي ابي خبرتكم واراءكم بالكويري اس كيو ال
الداتا بيسس موجوده بالمرفق
ارجو من الكل يشاركني
لان بصراحه محتاجه كل درجه بهالواجب
List the suppliers in Nebraska who sold us birds
select supplier,name from supplier S,city C,AnimalOrder AO,AnimalOrderItem AOI,SaleAnimal SA where s.cityID=C.cityID and s.SupplierID=Ao.SupplierID and AO.OrderID=AOI.OrderID and AOI.AnimalId=A.AnimalID and A.AnimalID=SA.AnimalID and C.State='NE' and A.Catogery='Bird'
;
Which state holds most of our customers?
SELECT DISTINCT Supplier.SupplierID, Supplier.Name, City.State, Animal.Category FROM (City INNER JOIN Supplier ON City.CityID = Supplier.CityID) INNER JOIN (AnimalOrder INNER JOIN (Animal INNER JOIN AnimalOrderItem ON Animal.AnimalID = AnimalOrderItem.AnimalID) ON AnimalOrder.OrderID = AnimalOrderItem.OrderID) ON Supplier.SupplierID = AnimalOrder.SupplierID WHERE (((City.State)="ne") AND ((Animal.Category)="bird"));
List the customers who have purchased cats from Gibson.
select name from Customer c,Employee e,Sale s, SaleAnimal SA,Animal A where A.AnimalID=SA.AnimalID and SA.SaleID=s.SaleID and s.EmployeeID=e.EmployeeID and A.catogery='cat' and c.LastName='Gibson'
;
Did the store sell more cats or dogs in the first quarter?
select count saleID from Sale s,Animal a,SaleAnimal sa where a.AnimalID=sa.AnimalID and sa.SaleID=s.SaleID and count saleID=(select Max(saleID) from SaleAnimal and (A.catogery='dog' or a.catogery='cat') and S.SaleDate=Between #1/1/2007# and 31/3/2007#);
Did the store sell more female or male animals in the fourth quarter?
ما عرفت احط التاريخ
select distinct AnimalID,gender,salePrice,saleDate from Animal a,SaleAnimal sa,Sale s where a.AnimalID=sa.Animal and sa.SaleID=s.SaleID and (s.SaleDate) Between (#1/10/--# and#31/12?--#)
Which employees sold the most dog merchandise in July and August?
select count name as from Employee e,Sale s,Animal a,Merchandise m where e.EmployeeID=s.EmployeeID and a.catogery=m.catogery and catogery ='dog' and (saledate=# 1/1/--#And#31/1/--#) or (saledate=#1/8/--#and 31/8/--#)
During the third quarter, which items have been ordered the most times
in more than 5-unit quantities?
لسه ما حليته ما فهمته
On average, which supplier charges the highest shipping cost as a percent
of the merchandise order total?
On average, which supplier charges the highest shipping cost as a percent
of the merchandise order total?
مش عرفت لان عايزين الافانزك كويري
Write a query to create the table shown in Exercise 18.
create table ( catogery varchar low interger high );
Write a query to insert the first row of data for the table in Exercise 18.
insert into (catogery,low,high) values(weak,0,200)
Create a query to delete the first row of the table in Exercise 18.
delete from table where (catogery,low.high) values(weak.0.200)