الانتقال إلى المحتوى

لو تكرمتوا ممكن مساعدة


spical101

Recommended Posts

[وسط]


السلام عليكم

لو سمحتو ممكن مساعدة في أوامر استعلام ,,

هذي الrelations

607997018.jpg

الاوامر الي اتمنى المساعدة فيها:

[وسط][يسار]1)For the taxis manufactured before the year 2000, started to be used as taxis after 1/1/2002, and driven by drivers 50 years old or more, add 1% of the average number of kilometers driven by taxis manufactured after year 2000.

[/يسار]

...:::::...

2) During the week 9-17/1/2009, give for each Toyota taxis the following: its ID, its manufacturing year and the driver names who drove that taxi and [وسط][يسار]got, during one day, above the average income for the same taxi got the last year within the same week. We will remove the duplicates.

[/يسار][/وسط][/وسط]

هذي حاولت فيها بالكود:

[left]Select distinct ssn, t_id, year, name
From taxi,transaction,driver Where ssn = driver_ssn and t_id = taxi_id and t_date > '8-1-2009' and t_date 
            < '18-1-2009' and t_model = 'TOYOTA' and income  >   (Select avg(income)
        From transaction Where t_date >'8-1-2008' and t_date < '18-1-2008' and t_model = 'TOYOTA');[/left]



الأمر نفذ لكن فيه مشكلتين.. الأولى ان لو في شخص ساق مرتين و دخله في مره أكبر من المتوسط وفي المره التنايه أقل من المتوسط بيعرض بياناته << المطلوب انه لازم في جميع المرات أكبر من المتوسط.
التانية كيف ألغي التكرار.


...:::::...


[يسار]Give the driver SSN for the drivers who drove the day 30/5/2009 all the taxis driven by the driver having ID=1234567890 during the day 11/05/2009.

[/يسار]

الكود:

Select ssn,taxi_id
[center][يسار]
From driver,transaction,taxi Where (Select taxi_id From taxi,transaction Where t_id = taxi_id and t_date ='09-01-2009') Contains (Select taxi_id From taxi,transaction,driver Where t_id = taxi_id and driver_ssn =1111111111 and t_date='10-01-2008');[/center]
[/يسار]



التواريخ الي حاطها في الكود كتجربه على المدخلات الي عندي << عارف انها تختلف عن الي في السؤال.

لمى اكتب هذا الكود يعطيني خطأ عند كلمة contains, هل الخطأ في الكود؟؟


::.. الي يعرف حل أي شي منها .. يا ريت يخدمني ..::

الله يعطيكم العافية,,

[/وسط]

رابط هذا التعليق
شارك

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   تمت استعادة المحتوى السابق الخاص بك.   مسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

جاري التحميل
×
×
  • أضف...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية