SlideShare une entreprise Scribd logo
1  sur  11
VERILERI GRUPLAYARAK ANALIZ
GRUP FONKSIYONLARI
 Tek satır fonksiyonları, tablonun bir satırına
uygulanabiliyordu. Bir grup satıra bir fonksiyonun
uygulanması söz konusu ise çoklu satır fonksiyonları
ya da diğer bir deyişle grup fonksiyonlarından söz
edilir.
Fonksiyonlar
Tek satır
fonksiyonları
Çoklu satır
fonksiyonları
AVG() VE SUM() FONKSIYONLARI
 AVG() fonksiyonu herhangi bir sütunun içerdiği
sayısal değerlerin aritmetik ortalamasını hesaplamak
amacıyla kullanılır.
SELECT AVG(ÜCRET) AS ORTALAMA FROM PERSONEL;
 SUM() fonksiyonu sütunların içerdiği sayısal değerleri
toplamak amacıyla kullanılır.
SELECT SUM(ÜCRET) AS TOPLAM FROM PERSONEL;
STDEV () VE VARP() FONKSIYONLARI
 STDEV() fonksiyonu sayısal verilerin standart
sapmasının hesaplanmasında kullanılan
fonksiyondur. ORACLE karşılığı STDDEV()’dir.
SELECT STDEV(ÜCRET) AS “STANDART SAPMA” FROM
PERSONEL;
 VARP() fonksiyonu bir dizi sayısal değerin standart
sapmasını hesaplamak için kullanılır. ORACLE
karşılığı VARIANCE()’dir.
SELECT VARP(ÜCRET) AS VARYANS FROM PERSONEL;
MAX() VE MIN() FONKSIYONLARI
 Tablonun içerdiği değerlerin içerdiği en büyük ve en
küçük olanlarını bulmak için MAX() ve MIN()
fonksiyonları kullanılır. Bu fonksiyonlar herhangi bir veri
türüne uygulanabilir.
SELECT MIN(ÜCRET) AS “EN AZ”, MAX(ÜCRET) AS “EN FAZLA”
FROM PERSONEL;
SELECT MAX(GİRİŞ_TAR) AS “EN SON” FROM PERSONEL;
SELECT MIN(ADI) AS “İLK İSİM” FROM PERSONEL;
COUNT() FONKSIYONU
 Bir tablodaki kayıtların tutulması amacıyla kullanılır.
İki farklı biçimde kullanılabilir:
 COUNT(*) fonksiyonu, NULL değerleri de içeren tüm
kayıtların sayılmasına neden olur.
SELECT COUNT(*) AS “KAYIT SAYISI” FROM PERSONEL
WHERE BÖLÜM_NO=‘30’;
 COUNT(sütun) biçiminde kullanılırsa NULL değerler
içermeyen tüm kayıtların sayılmasına neden olur.
SELECT COUNT(KOMİSYON) AS “KOMİSYON ALAN” FROM
PERSONEL;
GRUPLAMA İŞLEMLERİ
 Bir tablonun satırları gruplara ayrılarak, grup
fonksiyonlarının bunlara uygulanması sağlanabilir.
GROUP BY sözcüğünden faydalanılır.
Örnek: Personel tablosuna göre, her bölüm için
personel sayısını, ücret toplamını ve ortalama
ücretleri hesaplamak için:
SELECT BÖLÜM_NO, COUNT(ADI) AS SAYI, SUM(ÜCRET)
AS TOPLAM, AVG(ÜCRET) AS ORTALAMA FROM PERSONEL
GROUP BY BÖLÜM_NO;
BIRDEN FAZLA SÜTUNA GÖRE GRUPLAMA
 GROUP BY ile bir sütuna göre gruplama yapılabildiği
gibi, birden fazla sütun için de gruplama yapılabilir.
Örnek: Her bölümü ve bölüm içindeki görevlere göre
personeli gruplayarak bu bazda ücret toplamları elde
etmek için:
SELECT BÖLÜM_NO, GÖREVİ, SUM(ÜCRET) FROM
PERSONEL GROUP BY BÖLÜM_NO, GÖREVİ;
GRUP KOŞULLARININ KULLANIMI
 Grup işlemleri yerine getirilirken, grup bazında
sınırlamalar söz konusu olabilir. Örneğin, bölüm
bazında bir işlemin, bölüm ücret ortalamasının
2000’den büyük ise gerçekleşmesi istenebilir.
Hatalı
SELECT BÖLÜM_NO, AVG(ÜCRET) FROM PERSONEL
WHERE AVG(ÜCRET)>2000 GROUP BY BÖLÜM_NO;
Doğru
SELECT BÖLÜM_NO, AVG(ÜCRET) FROM PERSONEL
GROUP BY BÖLÜM_NO HAVING AVG(ÜCRET)>2000;
Grup koşulları WHERE içinde tanımlanamaz. Onun
yerine HAVING sözcüğü kullanılır.
GRUP KOŞULLARININ KULLANIMI
Örnek: Ortalama ücreti 3500’den fazla olan bölümlerin
bölüm numarası ve o bölümdeki en yüksek ücret
miktarını görüntülemek için:
SELECT BÖLÜM_NO AS “BÖLÜM NO”, MAX(ÜCRET) AS “EN
ÇOK” FROM PERSONEL GROUP BY BÖLÜM_NO HAVING
AVG(ÜCRET)>3500;
GRUP KOŞULLARININ KULLANIMI
Örnek: Pazarlama bölümü dışında çalışan personeli
görevlerine göre gruplandırıp ücretleri toplayan;
bölümün toplam ücretini 5000’den fazla olanlar seçen
ve sonuçları en düşük ücret toplamından büyüğe
doğru sıralamak için:
SELECT GÖREVİ, SUM(ÜCRET) AS TOPLAM FROM
PERSONEL WHERE GÖREVİ <> ‘PAZARLAMACI’ GROUP BY
GÖREVİ HAVING SUM(ÜCRET) > 5000 ORDER BY
SUM(ÜCRET);

Contenu connexe

En vedette

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

En vedette (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Verileri_gruplayarak_analizdosyaladi.ppt

  • 2. GRUP FONKSIYONLARI  Tek satır fonksiyonları, tablonun bir satırına uygulanabiliyordu. Bir grup satıra bir fonksiyonun uygulanması söz konusu ise çoklu satır fonksiyonları ya da diğer bir deyişle grup fonksiyonlarından söz edilir. Fonksiyonlar Tek satır fonksiyonları Çoklu satır fonksiyonları
  • 3. AVG() VE SUM() FONKSIYONLARI  AVG() fonksiyonu herhangi bir sütunun içerdiği sayısal değerlerin aritmetik ortalamasını hesaplamak amacıyla kullanılır. SELECT AVG(ÜCRET) AS ORTALAMA FROM PERSONEL;  SUM() fonksiyonu sütunların içerdiği sayısal değerleri toplamak amacıyla kullanılır. SELECT SUM(ÜCRET) AS TOPLAM FROM PERSONEL;
  • 4. STDEV () VE VARP() FONKSIYONLARI  STDEV() fonksiyonu sayısal verilerin standart sapmasının hesaplanmasında kullanılan fonksiyondur. ORACLE karşılığı STDDEV()’dir. SELECT STDEV(ÜCRET) AS “STANDART SAPMA” FROM PERSONEL;  VARP() fonksiyonu bir dizi sayısal değerin standart sapmasını hesaplamak için kullanılır. ORACLE karşılığı VARIANCE()’dir. SELECT VARP(ÜCRET) AS VARYANS FROM PERSONEL;
  • 5. MAX() VE MIN() FONKSIYONLARI  Tablonun içerdiği değerlerin içerdiği en büyük ve en küçük olanlarını bulmak için MAX() ve MIN() fonksiyonları kullanılır. Bu fonksiyonlar herhangi bir veri türüne uygulanabilir. SELECT MIN(ÜCRET) AS “EN AZ”, MAX(ÜCRET) AS “EN FAZLA” FROM PERSONEL; SELECT MAX(GİRİŞ_TAR) AS “EN SON” FROM PERSONEL; SELECT MIN(ADI) AS “İLK İSİM” FROM PERSONEL;
  • 6. COUNT() FONKSIYONU  Bir tablodaki kayıtların tutulması amacıyla kullanılır. İki farklı biçimde kullanılabilir:  COUNT(*) fonksiyonu, NULL değerleri de içeren tüm kayıtların sayılmasına neden olur. SELECT COUNT(*) AS “KAYIT SAYISI” FROM PERSONEL WHERE BÖLÜM_NO=‘30’;  COUNT(sütun) biçiminde kullanılırsa NULL değerler içermeyen tüm kayıtların sayılmasına neden olur. SELECT COUNT(KOMİSYON) AS “KOMİSYON ALAN” FROM PERSONEL;
  • 7. GRUPLAMA İŞLEMLERİ  Bir tablonun satırları gruplara ayrılarak, grup fonksiyonlarının bunlara uygulanması sağlanabilir. GROUP BY sözcüğünden faydalanılır. Örnek: Personel tablosuna göre, her bölüm için personel sayısını, ücret toplamını ve ortalama ücretleri hesaplamak için: SELECT BÖLÜM_NO, COUNT(ADI) AS SAYI, SUM(ÜCRET) AS TOPLAM, AVG(ÜCRET) AS ORTALAMA FROM PERSONEL GROUP BY BÖLÜM_NO;
  • 8. BIRDEN FAZLA SÜTUNA GÖRE GRUPLAMA  GROUP BY ile bir sütuna göre gruplama yapılabildiği gibi, birden fazla sütun için de gruplama yapılabilir. Örnek: Her bölümü ve bölüm içindeki görevlere göre personeli gruplayarak bu bazda ücret toplamları elde etmek için: SELECT BÖLÜM_NO, GÖREVİ, SUM(ÜCRET) FROM PERSONEL GROUP BY BÖLÜM_NO, GÖREVİ;
  • 9. GRUP KOŞULLARININ KULLANIMI  Grup işlemleri yerine getirilirken, grup bazında sınırlamalar söz konusu olabilir. Örneğin, bölüm bazında bir işlemin, bölüm ücret ortalamasının 2000’den büyük ise gerçekleşmesi istenebilir. Hatalı SELECT BÖLÜM_NO, AVG(ÜCRET) FROM PERSONEL WHERE AVG(ÜCRET)>2000 GROUP BY BÖLÜM_NO; Doğru SELECT BÖLÜM_NO, AVG(ÜCRET) FROM PERSONEL GROUP BY BÖLÜM_NO HAVING AVG(ÜCRET)>2000; Grup koşulları WHERE içinde tanımlanamaz. Onun yerine HAVING sözcüğü kullanılır.
  • 10. GRUP KOŞULLARININ KULLANIMI Örnek: Ortalama ücreti 3500’den fazla olan bölümlerin bölüm numarası ve o bölümdeki en yüksek ücret miktarını görüntülemek için: SELECT BÖLÜM_NO AS “BÖLÜM NO”, MAX(ÜCRET) AS “EN ÇOK” FROM PERSONEL GROUP BY BÖLÜM_NO HAVING AVG(ÜCRET)>3500;
  • 11. GRUP KOŞULLARININ KULLANIMI Örnek: Pazarlama bölümü dışında çalışan personeli görevlerine göre gruplandırıp ücretleri toplayan; bölümün toplam ücretini 5000’den fazla olanlar seçen ve sonuçları en düşük ücret toplamından büyüğe doğru sıralamak için: SELECT GÖREVİ, SUM(ÜCRET) AS TOPLAM FROM PERSONEL WHERE GÖREVİ <> ‘PAZARLAMACI’ GROUP BY GÖREVİ HAVING SUM(ÜCRET) > 5000 ORDER BY SUM(ÜCRET);