بتاريخ: 21 يونيو 200718 سنة comment_102997 كيف احصل علي ثاني اكبر راتب في جدول الموظفين تاني اعلي راتب فقط في ريكورد لوحدو تقديم بلاغ
بتاريخ: 21 يونيو 200718 سنة comment_103057 جرب هذا الكود select salary , rownum from (select salary from employees order by salary desc) where rownum = 2; تقديم بلاغ
بتاريخ: 23 يونيو 200718 سنة comment_103208 بسم الله الرحمن الرحيمممكن أخي العزيز أن تستخدم هذا الكودselect max(sal) from empwhere sal <(max(sal) from empاخوك موسى miash80 تقديم بلاغ
بتاريخ: 23 يونيو 200718 سنة comment_103225 بسم الله الرحمن الرحيم select max(sal)from empwhere sal <(max(sal) from emp أعتقد ان هذا الكود سوف يولد خطأ فالدالة max لا يجوز ان تستخدم مع where لأن الـ group function لا يجوز مناداتها مع where .... وان كنا نريد إستخدامها لفلترة البيانات فمكانها مع Having وليس مع where تقديم بلاغ
بتاريخ: 30 يوليو 200718 سنة comment_106146 بالفعل الأكواد السابقة خطأالكود الصحيح هو SELECT max(sal) FROM emp WHERE sal <> (select max(sal) from emp); بالتوفيق للجميع تقديم بلاغ
بتاريخ: 31 يوليو 200718 سنة comment_106165 كيف احصل علي ثاني اكبر راتب في جدول الموظفين تاني اعلي راتب فقط في ريكورد لوحدو :angry: نعم هناك بالفعل دالة اسمها rankselect emp,sale,rank()over(orderby sale)rank from emp_sale تقديم بلاغ
بتاريخ: 7 مايو 200817 سنة comment_128222 السلام عليكم هذا هو الكودselect max(sal) from emp where sal <(select max(sal) from emp); tوالفكره ببساطه انو اجيب اكبر راتب وبعدين اجيب اكبر راتب بحيث يكون اصغر من الراتب الي جبته بالاول تقديم بلاغ
بتاريخ: 8 مايو 200817 سنة comment_128312 السلام عليكمالحل هو الصحيح هو select sal , rownum from (select sal from emp order by sal desc) where rownum <=2 ; وشكراميجا تقديم بلاغ
بتاريخ: 11 مايو 200817 سنة comment_128539 select max (sal)from empwhere sal <> (select max ( sal) from emp); تقديم بلاغ
بتاريخ: 30 نوفمبر 200817 سنة comment_144069 السلام عليكم ورحمة الله وبركاتهأخى الكريم أريد كود للحصول على إسم وراتب أكبر عشر رواتب للموظفين أرجو التكرم بكتابة الكود ولك جزيل الشكر تقديم بلاغ
بتاريخ: 30 نوفمبر 200817 سنة comment_144073 السلام عليكم ANK calculates the rank of a value in a group of values. Rows with equal values for the ranking criteria receive the same rank. Oracle then adds the number of tied rows to the tied rank to calculate the next rank. Therefore, the ranks may not be consecutive numbers. As an aggregate function, RANK calculates the rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification. The arguments of the function must all evaluate to constant expressions within each aggregate group, because they identify a single row within each group. The constant argument expressions and the expressions in the ORDER BY clause of the aggregate match by position. Therefore, the number of arguments must be the same and their types must be compatible. As an analytic function, RANK computes the rank of each row returned from a query with respect to the other rows returned by the query, based on the values of the value_exprs in the order_by_clause. Syntax Aggregate Syntax: rank_aggregate vÄÄ,ÄÄÄ¿ >ÄÄRANKÄÄ(ÄÄexprÄÁÄ)ÄÄWITHIN GROUPÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ> vÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ,ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ >ÄÄ(ORDER BYÄÄexprÄÂÄÄÄÄÄÄÄÄÂÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÁÄ)ÄÄÄÄÄÄÄÄÄÄÄÄÄ>< ÀÂÄDESCÂÄÙ ÀÄNULLSÄÂÄFIRSTÄÂÄÙ ÀÄASCÄÙ ÀÄLASTÄÄÙ Analytic Syntax: rank_analytic >ÄÄRANKÄÄ()ÄOVERÄÄ(ÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄorder_by_clause)ÄÄ>< ÀÄquery_partition_clauseÄÙ Aggregate Example The following example calculates the rank of a hypothetical employee in the sample table hr.employees with a salary of $15,500 and a commission of 5%: SELECT RANK(15500, .05) WITHIN GROUP (ORDER BY salary, commission_pct) "Rank" FROM employees; Rank ---------- 105 Similarly, the following query returns the rank for a $15,500 salary among the employee salaries: SELECT RANK(15500) WITHIN GROUP (ORDER BY salary DESC) "Rank of 15500" FROM employees; Rank of 15500 -------------- 4 Analytic Example The following statement ranks the employees in the sample hr schema within each department based on their salary and commission. Identical salary values receive the same rank and cause nonconsecutive ranks. Compare this example with the example for DENSE_RANK. SELECT department_id, last_name, salary, commission_pct, RANK() OVER (PARTITION BY department_id ORDER BY salary DESC, commission_pct) "Rank" FROM employees; DEPARTMENT_ID LAST_NAME SALARY COMMISSION_PCT Rank ------------- --------------- ---------- -------------- ---------- 10 Whalen 4400 1 20 Hartstein 13000 1 20 Goyal 6000 2 30 Raphaely 11000 1 30 Khoo 3100 2 30 Baida 2900 3 30 Tobias 2800 4 تقديم بلاغ
بتاريخ: 30 نوفمبر 200817 سنة comment_144087 بالنسبة للكود SELECT max(sal) FROM emp WHERE sal <> (select max(sal) from emp);فانه يظهر اعلى ثاني راتب . ماذا لو اردت اعلى ثالث راتب او الرابع أو ......................الخ (غير ثانبت)اما بالنسبة للكود select sal , rownumfrom (select sal from emp order by sal desc) where rownum <=2 ; فانه يظهر الراتب الاول والثاني وانا ارديد الثاني فقط او الثالث او الرابع .............................الخيا ريت لو يشاركني بهذه الأسئلة تقديم بلاغ
بتاريخ: 3 ديسمبر 200817 سنة comment_144304 -- جلب ثاني أكبر راتب. SELECT MAX(SAL) AS MAX_SAL FROM EMP WHERE SAL < (SELECT MAX(SAL) - 1 FROM EMP) -- جلب أول أكبر 10 رواتب-- SELECT EMPNO,SAL FROM (SELECT EMPNO,SAL FROM EMP ORDER BY SAL DESC) T WHERE ROWNUM <= 10 -- جلب آخر أصغر 10 رواتب-- SELECT EMPNO,SAL FROM (SELECT EMPNO,SAL FROM EMP ORDER BY SAL) T WHERE ROWNUM <= 10 تقديم بلاغ
بتاريخ: 3 ديسمبر 200817 سنة comment_144315 تابع الرابط الاتىلو تريد فقط ثالث اكبر قيمةhttp://www.araboug.org/ib/index.php?showto...t=0#entry144314 تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.