بتاريخ: 27 أكتوبر 200421 سنة comment_16568 DECLARE RG RECORDGROUP; I NUMBER; BEGIN RG := FIND_GROUP('GR_NAME'); IF ID_NULL(RG) THEN RG := CREATE _GROUP_FROM_QUERY('GR_NAME', 'SELECT EMPNO, COMM FROM EMP); END IF; I := POPULATE_GROUP(RG); CLEAR_LIST('MY_LIST'); POPULATE_LIST('GR_NAME', RG); END; ___________________________________________________________________________1/في البداية نقوم بتعريف متغير من نوع ريكورد قروب ومتغير من نوع رقم 2/بعد ذلك نقوم بعملية تشييك ما إذا كانت القروب موجودة 3/اذا لم يكن موجودا , نقوم بإنشاءه عن طرق استخدام create_group_from_query3/بعد ذلك نقوم بتسكين البيانات في القرووب عن طريق populate_group4/بعد ذلك نقوم بعمل وضع القيم من القروب في ال list itemأرجو من الله أنني وفقت في شرح هذا الموضوع تقديم بلاغ
بتاريخ: 1 فبراير 200620 سنة comment_59115 SQL: GROUP BY Clause--------------------------------------------------------------------------------The GROUP BY clause can be used in a SELECT statement to collect data across multiple records and group the results by one or more columns.The syntax for the GROUP BY clause is: SELECT column1, column2, ... column_n, aggregate_function (expression) FROM tables WHERE predicates GROUP BY column1, column2, ... column_n; aggregate_function can be a function such as SUM, COUNT, MIN, or MAX.Example using the SUM functionFor example, you could also use the SUM function to return the name of the department and the total sales (in the associated department). SELECT department, SUM(sales) as "Total sales" FROM order_details GROUP BY department; Because you have listed one column in your SELECT statement that is not encapsulated in the SUM function, you must use a GROUP BY clause. The department field must, therefore, be listed in the GROUP BY section.Example using the COUNT functionFor example, you could use the COUNT function to return the name of the department and the number of employees (in the associated department) that make over $25,000 / year. SELECT department, COUNT(*) as "Number of employees" FROM employees WHERE salary > 25000 GROUP BY department; Example using the MIN functionFor example, you could also use the MIN function to return the name of each department and the minimum salary in the department. SELECT department, MIN(salary) as "Lowest salary" FROM employees GROUP BY department; Example using the MAX functionFor example, you could also use the MAX function to return the name of each department and the maximum salary in the department. SELECT department, MAX(salary) as "Highest salary" FROM employees GROUP BY department; تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.