التميمية بتاريخ: 17 أغسطس 2007 تقديم بلاغ مشاركة بتاريخ: 17 أغسطس 2007 عندي عدة جداول مخزنة بالاوراكل في قاعدة مستقلة والمطلوب Which manufacturer gave Rolling Thunder the largest discount on an order in 2003?The information we need comes from Manufacturer & PurchaseOrder tables.We need the attributes : ManufacturerID, ManufacturerName,OrderDate, DiscountThe WHERE condition is the year 2003, which means PurchaseOrder OrderDate is Between #1/1/2003# And #12/31/2003#To find out the largest discount, you can sort Discount attribute in Descending orderأنا كتبت هذا الكود لكن للأسف فيه خطأ ونقص يظهر لي ORA-00918: column ambiguously defined والكود الذي كتبت SELECT ManufacturerID, ManufacturerName,OrderDate, DiscountFROM Manufacturer INNER JOIN PurchaseOrderON Manufacturer.ManufacturerID = PurchaseOrder.ManufacturerIDWHERE OrderDate Between '1/1/2003' And '12/31/2003'ORDER BY Discount DESC;أرجو المساعدة اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
التميمية بتاريخ: 17 أغسطس 2007 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 17 أغسطس 2007 حطيت الكود كذا SELECT Manufacturer.ManufacturerID, ManufacturerName, OrderDate, DiscountFROM Manufacturer, PurchaseOrderWHERE Manufacturer.ManufacturerID = PurchaseOrder.ManufacturerIDAND OrderDate Between '1/1/2002' AND '31/12/2003';ORDER BY Discount DESC;طلع لي ORA-00911: invalid character !! اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Amgad بتاريخ: 18 أغسطس 2007 تقديم بلاغ مشاركة بتاريخ: 18 أغسطس 2007 يتم وضع علامة ; فى نهاية الامر .. وليس فى المنتصف .. وان كنت تستعمل oracle 10 XE يمكنك عدم اضافة ال ; فى نهاية الامر فيما يتعلق بالعام 2003 .. ستحتاج تعديل التاريخ from 1-1-2003 وليس 1-1-2002 select manufacturer.manufacturerid , manufacturername , orderdate,discount from purchaseorder , manufacturer where purchaseorder.manufacturerid = manufacturer.manufacturerid and orderdate between '01/01/2003' and '31/12/2003' order by discount desc اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
التميمية بتاريخ: 18 أغسطس 2007 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 18 أغسطس 2007 ما تقصر أخي الكريموسؤال : هل ممكن تختلف صياغة الأكواد والنتيجة تكون واحدة ؟أنا مبتدئة جدا فتحملنيوهذا سؤال والمطلوب منه في الأسفلإذا مافيه ماتع تساعدني وأدعو لك في ظهر الغيب* 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المطلوب هو تحديد العنصر الاكثر كلفة والموجود بالمخازن (الاكثر كلفه بمعنى الكمية المتوفرة * السعر التقريبي)[EstimatedCost]*[QuantityOnHand]حاصل هذه العملية ينتج عنه تكلفة القطعة الواحدة فقط ولكن اذا اضفنا اليه الدالة SUM سينتج عنه تكلفه كافة القطعوبالطبع كما اوضحنا في حالة استخدام الدالة SUM لابد من اضافة Group byوكذلك لابد من الربط بين الجدولين باستخدام INNER JOINوفي النهاية يتم فرزالبيانات على اساس هذا العمود الحسابي الجديد ORDER BY اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Amgad بتاريخ: 18 أغسطس 2007 تقديم بلاغ مشاركة بتاريخ: 18 أغسطس 2007 select component.componentid , manufacturername , productnumber, year , category , sum( estimatedcost* quantityonhand ) as SittingOnShelf from component , manufacturer where component.manufacturerid = manufacturer.manufacturerid group by component.componentid , manufacturername , productnumber, year , category order by SittingOnShelf desc اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
التميمية بتاريخ: 22 أغسطس 2007 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 22 أغسطس 2007 حطيت الكود هذا طلع لي ORA-01722: invalid number ؟؟ اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Amgad بتاريخ: 23 أغسطس 2007 تقديم بلاغ مشاركة بتاريخ: 23 أغسطس 2007 اعتقد انه .. يوجد مشكلة بالبيانات بالجداول .. هل البيانات مدخلة بطريقه صحيحه بالجداول ؟؟ ORA-01722 ORA-01722invalid number Cause:The attempted conversion of a character string to a number failed because the character string was not a valid numeric literal. Only numeric fields or character fields containing numeric data may be used in arithmetic functions or expressions. Only numeric fields may be added to or subtracted from dates. Action:Check the character strings in the function or expression; make sure they contain only numbers, a sign, a decimal point, and the character "E" or "e", then retry the operation. اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Recommended Posts
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.