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

أين الخطأ هنا ؟ in this select statment


التميمية

Recommended Posts

SELECT Bicycle.SerialNumber, Bicycle.ModelType, Bicycle.OrderDate, ([shipDate.Bicycle],[OrderDate.PurchaseOrder]) AS BuildDelay

FROM Bicycle

WHERE (((Bicycle.OrderDate) Between '1\1\2002' And '12\31\2002')) AND

(([shipDate.Bicycle]-[OrderDate.PurchaseOrder])>2*(SELECT Avg([shipDate.Bicycle]-[ORderdate.PurchaseOrder])) AS BuildDelay

FROM Bicycle

WHERE (((Bicycle.StartDate) Between '1\1\2002' And '12\31\2002'))

)

ORDER BY [shipDate.Bicycle]-[ORderdate.PurchaseOrder) DESC;







-----

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

لكتابة امر ال select بشكل صحيح .. يفضل وجود وصف الجداول

هل يمكن ارفاق وصف الجداول .. أو dump file ... للمستخدم المنشأ به الجداول

مع تحديد ما هو المطلوب استخراجه من امر ال select

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

أشكر لك
تعاوتنك ، والمطلوب

* The information we need comes from Manufacturer & Component tables.
* We need the attributes : ComponentID, ManufacturerName,
ProductNumber, Year, Category
* We need to create a NEW Calculated Attribute to find out the value of all the bikes available in stock. Now if we want to find the money sitting on the shelf (cost of quantity on hand) we will need to mutliply EstimatedCost * QuantityOnhand. This new attribute will give us the cost of the quantity of one product, we need the SUM of this attribute
* If you are going to use an aggregate function like SUM, you need to use GroupBy. Remember that the results must be grouped by all the attributes you have chosen in the SELECT part of your statement
* To find out the most money, you sort the NEW Calculated Attribute attribute in Descending order

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

حسب الشرح السابق .. اليك هذا الكود

select component.componentid , manufacturername , productnumber, year , category ,  sum( estimatedcost* quantityonhand ) as TotalOnShelf
from component , manufacturer
where component.manufacturerid = manufacturer.manufacturerid 
group by component.componentid  , manufacturername , productnumber, year , category 
order by TotalOnShelf desc;

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

في الحقيقة كفيتني عناء حل هذا السؤال

فشكرا ألف

والكود الذي أشرت أنا إليه في البداية إنما هو كود لمطلوب آخر هو ما يلي (أريد تصحيح لكودي الأول)


* The information we need comes from Bicycle Table.
* We need the attributes SerialNumber, ModelType, OrderDate
* A NEW calculated attribute to find out the building delay, it should subtract ShipDate from OrderDate
* The WHERE condition has

OrderDate Between #1/1/2002# And #12/31/2002#
AND "use subquery" delay> 2*the average delay for bicycles with StartDate Between #1/1/2002# And #12/31/2002

* sort the data in descending order according to Delay attribute



يا إلهي اجز ِ أمجد خير الجزاء لقد أرسلت لي الكود عبر الخاص شكرا لك

بالنسبة للكود الأخير رقم 27 يظهر لي فيه هذا الخطأ

ORA-01830: date format picture ends before converting entire input string

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

ORA-01830 

ORA-01830date format picture ends before converting entire input string 

Cause:A valid date format picture included extra data. The first part of the format picture was converted into a valid date, but the remaining data was not required. 

Action:Check the specifications for date format pictures and correct the statement



سبب ظهور هذه الرسالة هو اختلاف التعامل مع شكل التاريخ
يمكنك استبدال الرقم لشهر 01 بحروف شهر يناير jan
رقم شهر 2 بحروف شهر فبراير feb
وهكذا باقى الشهور
لان شكل التاريخ قد يكون DD_MON-YYYY
يمكنك تعديل الامر كالتالى

select serialnumber, modeltype, orderdate,saleprice, shipdate,( shipdate - orderdate ) as  buildingdelay  
from bicycle 
where orderdate between '01-jan-2002' and '31-dec-2002'
and  shipdate - orderdate > 2 * 
(select avg(shipdate - orderdate ) from bicycle 
			where startdate between '01-jan-2002' and '31-dec-2002' )
order by buildingdelay desc



أو استخدام وظيفه to_char
عند التعامل مع التواريخ

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

ORA-01858: a non-numeric character was found where a numeric was expected

يكلع لي بعدد التعديل هذا الخطأ

تتوقع فيه خطأ في نوع البيانات في احد الاعمدة ؟

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

أبشرك ضبط معاي

شكرا لك

وممكن تتحمّل أسئلتي شوي ولا مؤاخذة مساعدتك تبرد القلب :rolleyes:

في هذا السؤال يقول :

What is a transaction and why do they have to be defined by developers?

Refer to pages 274 and 294 (A Developer's View) for answers to this question.

ولما رجعت للكتاب لقيت هذا الكلام

Miranda learned that even a good DBMS requires programming to handle some complex issue. In developing a system, developers should examine all of the business processes and identify transaction elements. Also, they have to be sure that UPDATE and DELETE procedure s can handle concurrency issues.
Also professional application handle errors gracefully, write data triggers or module code to automate basic processes and perform all needed calculations, write additional cursor-based code if needed to perform advanced calculations.


شو المقصود أدري اسئلة تافهة بس ترى ماعندنا معلم يوضح يعني نعلم انفسنا بانفسنا

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

الTransaction هى عباره عن مجموعه من الاوامر المتتابعه التى يجب ان تنفذ جميعها بالكامل .
المبرمج او مطور البرامج يجب ان يتأكد من تنفيذ هذه الtransactions بطريقه صحيحه ومجتمعه .. مثل التأكد من اتمام عمليات التعديل للبيانات بطريقه صحيحه بدون وجود مشاكل برمجيه وايضا متابعة اتمام عمليات الالغاء للسجلات .
ويمكن التأكد من ذلك من خلال اظهار رسائل تفيد اتمام الاوامر بشكل صحيح .. وايضا اظهار رسائل خطأ فى حالة وجود مشاكل بالبرنامج . ويمكن للمبرمج استخدام اساليب مختلفه لتحقيق ذلك منها العمليات الحسابيه والتعامل مع ال cursor داخل البرنامج للتعامل مع البيانات .
والمثال على الtransaction هو عملية السحب المالى من عميل ا واضافة المبلغ للعميل ب ( تحويل مبلغ من حساب بنكي الى حساب بنكى اخر )
وحتى تعتبر الحركة صحيحه يجب ان تتم عملية تخفيض الرصيد من العميل ا .. وايضا يجب ان يضاف المبلغ للعميل ب
اى ان امر ال update لكلا العميلين ا و ب يجب ان تتم بالكامل
واذا حدث خلل بطريقه ما .. وتم اجراء تنفيذ لعملية التعديل لرصيد العميل ا وتخفيض رصيده البنكى ... ثم حدثت مشكلة معينه بالجهاز ولم يحدث تعديل للرصيد البنكي للعميل ب ...
فان البرنامج يجب ان يعيد الارصده للعميلين ا و ب كما كانت قبل تنفيذ عملية السحب والايداع .

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

مجموعة الاوامر المجتمعه معا والتى تعتبر حركة واحدة transaction والتى يجب ان تنفذ كلها معا
يجب ان يحددها المبرمج او مطور البرامج .. فهو الذى يحدد اين هى بدايه اوامر ال Transaction ويحدد نهايتها ..
ويستخدم فى ذلك اساليب البرمجه المختلفة .. التى تضمن التنفيذ الصحيح للtransaction وكيفيه معالجة الموقف فى حالة وجود مشاكل فى تنفيذ الاوامر داخل ال transaction

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

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

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

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

×   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.

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

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

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