الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

بليز راجعوا معاي وصححوا لي

مغلق
بدأه sondos15 في 19 مايو 2007 · 3 رد · 1,541 مشاهدة · في قسم لغة الاستفسارات SQL
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

لسلام عليكم

اصدقائي ابي خبرتكم واراءكم بالكويري اس كيو ال

الداتا بيسس موجوده بالمرفق

ارجو من الكل يشاركني

لان بصراحه محتاجه كل درجه بهالواجب

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)

petstore.zip

#2

Create a data trigger that writes a row in a new table whenever employee

salary is changed. Store the date changed, the employee, the old salary and the new

value.

CREATE TRIGGER LogSalaryChanges

AFTER UPDATE OF Salary ON Employee

REFERENCING OLD ROW as oldrow

						 NEW ROW AS newrow

FOR EACH ROW

			INSERT INTO SalaryChanges 

			(EmpID, ChangeDate, User, OldValue, NewValue)

			VALUES 

			(newrow.EmployeeID, CURRENT_TIMESTAMP,

			CURRENT_USER, oldrow.Salary, newrow.Salary);

Create a data trigger that will prevent anyone from increasing an

employee salary by more than 50 percent.

CREATE TRIGGER DeletIncreaseSalary

BEFORE DELETE ON Employee

REFERENCING OLD ROW AS oldrow

FOR EACH ROW

			WHEN (oldrow.Title = ‘SALARY’)

						SIGNAL _CANNOT_INCREASE_SALARY;
#3

انا كلامي عن اول كويري انا شايف فيها A.AnimalID و A.Catogery بينما لا يوجد اي جدول عندك اختصاره هو A ؟؟؟؟؟؟؟

#4

سلام

صحيح شكرا لملاحظتك

نسيت احط

Aniaml A

هذا الموضوع مغلق.

مواضيع مشابهة