الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

شرح In Line View

Featured Replies

بتاريخ:

بسم الله الرحمن الرحيم

ان شاء هنتناول شرح ال In-line View فى ال SQL

ايه و ظيفتها و اهميتها ؟؟
ال In-line View هى طريقة لكتابة SELECT Statement عند FROM
يعنى اكتب FROM (SELECT * FROM ) و بمعنى تانى انى استخدم ال Sub Query زى ال Table
الطريقة دى مفيده جدا فى حالة انى بعمل Complex Query
ممكن استخدمها فى انى اعمل Join معاها

امثله على ال In-Line View

اول مثال لو عايز اجيب الموظفين اللى عندهم اعلى مرتب فى كل اداره


SELECT a.last_name, a.salary, a.department_id, b.maxsal

FROM employees a,
( SELECT department_id, max(salary) maxsal
FROM employees
GROUP BY department_id ) b

WHERE a.department_id = b.department_id AND a.salary = b.maxsal;


هنا انا بستخدم Agg Function جوا ال In-Line view عشان اقدر اجيب ال Maxsal و بدى ال Function اسم تانى "Alias" و ال In-Line View بديها Alias و فى ال Main Select Statement بكتب  Inline veiw Alias.Function Alias عشان استخدمها بدون Group by و اقدر اعرض معاها اكتر من Column

مثال
SELECT *
FROM ( SELECT deptno, count(*) emp_count
FROM emp
GROUP BY deptno ) emp,
dept
WHERE dept.deptno = emp.deptno;


و دا مثال Advanced لل DBA عشان تحسب المساحه الفاضيه فى Tablespace

 

column "Tablespace" format a13
column "Used MB" format 99,999,999
column "Free MB" format 99,999,999
column "Total MB" format 99,999,999

select fs.tablespace_name "Tablespace",
(df.totalspace - fs.freespace) "Used MB",
fs.freespace "Free MB",
df.totalspace "Total MB",
round(100 * (fs.freespace / df.totalspace)) "Pct. Free"
from
(select tablespace_name, round(sum(bytes) / 1048576) TotalSpace from dba_data_files group by tablespace_name ) df, (select tablespace_name, round(sum(bytes) / 1048576) FreeSpace from dba_free_space group by tablespace_name ) fs
where df.tablespace_name = fs.tablespace_name;

بتاريخ:

شكرا جدا مجهود رائع باك الله فيك

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

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

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

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

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

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.