Fundamental, Desain, dan Implementasi

Slides:



Advertisements
Presentasi serupa

Advertisements

SQL.
SQL (Structured Query Language)
PERINTAH SQL.
Praktikum Database Query Tingkat Lanjut Abdul Kadir.
SQL Basis Data.
SQL ADVANCEADVANCE. SQL Data Type MySQL Text Type : 9/7/2014By : Suwondo, S.Kom2.
SQL.
SISTEM BASISDATA Lasmedi Afuan, ST.,M.Cs. SQL (S RUCTURE Q UERY L ANGUAGE ) Query/SQL : Bahasa standar yang digunakan untuk mengakses basisdata. Standar.
Query Agregasi akhmadzaini.
Jalankan script sql berikut : sekolah.sql
DATA AGREGAT MENGGUNAKAN GROUP FUNCTIONS
Pemrograman Visual II Database Management System (DBMS) Oleh: Erna Sri Hartatik, S.Kom
SQL 2. Database TRANSACTION Tabel yang terlibat : Customer berisi data pelanggan (nama, alamat, dll) OderInfo berisi info pemesanan oleh pelanggan (tgl.
Microsoft SQL Server DDL dan DML dasar
Fungsi Agregat fungsi yang mengambil suatu kumpulan nilai-nilai sebagai input dan mengembalikan satu nilai sebagai output Select fungsi agregat SUM/AVG/MIN/MAX/COUNT.
Data Definition Language dan Data Manipulation Language
Praktikum Database Subquery Lanjutan dan View Abdul Kadir.
Data Manipulation Language Pertemuan : 4 Basis Data Terapan.
MANAJEMEN BASIS DATA Pertemuan 6 SQL - SELECT.
P E R T E M U A N 12 SISTEM BASIS DATA.
Advanced Query Formulation dengan SQL
SQL-Aggregate dengan Fungsi GROUP, HAVING dan subQuery
SQL: DML (2) Basis Data Pertemuan 07.
Dr. KUSRINI, M.KOM 66. Select * From nama_tabel [Where Kondisi] [Order by Kolom_x] Atau Select Kolom_1,Kolom_2,..Kolom_n From nama_tabel [Where Kondisi]
MANAJEMEN BASIS DATA Pertemuan 8 SUBQUERY.
Data Manipulation Language
PERTEMUAN 10 QUERY KOMERSIAL LANJUTAN Agus Riyanto, S.Kom.
PRAKTIKUM BASIS DATA (4) TEKNIK INFORMATIKA UNIVERSITAS MERCU BUANA
Data Manipulation Language Presented by : Herianto.
PTIK-13 PERANCANGAN DATABASE (2) MENGOLAH DATA MENJADI INFORMASI Dosen: Arya Yudhi W.,S.Kom.,M.Kom.
SQL (Structure Query Language)
SQL (Structure Query Language) Pertemuan 3 – RESTRICTING AND SORTING DATA sy urf gm ail. co m.
SQL (Structure Query Language) Pertemuan 5 – Reporting Aggregate Data Using the Group Function sy urf gm ail. co m.
SQL-Pembatas dan Pengurutan Data
Modul SBD-2 …….. SQL Server

Pertemuan ke-sekian Structure Query Language (SQL) Lanjut
Structure Query Language
Rekayasa Perangkat Lunak Materi 3 (Database)
SQL (Structured Query Language)
Query.
Query Query adalah statement yang berada dalam SQL untuk menampilkan suatu data dari database dimana data diambil dari satu atau beberapa tabel.
Query.
Structured Query Language
EXIT KD 3.4 “ Fungsi-Fungsi Agregasi “. MATERI Disusun Oleh :
Stucture Query Language
Connect to the Server - Putty
Stucture Query Language
QUERY SQL Modul Query.
ALJABAR RELASIONAL dan QUERY
Structured Query Language (SQL)
SQL Data Manipulation IK203 Sistem Basis Data Pertemuan #12
Perintah Manipulasi Data
Jalankan script sql berikut : sekolah.sql
Sesi VI Query dengan SQL
Rekayasa Perangkat Lunak (Materi 2 Database)
MODUL 4 MENAMPILKAN DATA DARI SATU TABEL
Structure Query Language (II)
SQL (Structured Query Language) Oleh : Cosmas Haryawan.
MODUL 4 MENAMPILKAN DATA DARI SATU TABEL
Database User Account.
SQL(SELECT QUERY LANGUAGE)
Basis Data Bab 3 Structured Query Language (SQL).
Latihan Uraikan fungsi setiap kata pada SELECT statement. Apakah yang membatasinya? Apa hambatan memakai aggregate functions pada SELECT statement? Kenapa.
DATA MANIPULATION LANGUAGE
Structured query language (sql)
BAHASA BASIS DATA Data Manipulation Languange
BAHASA BASIS DATA Retreiving Data dan Manipulation Function
Transcript presentasi:

Fundamental, Desain, dan Implementasi Pengolahan Database : Fundamental, Desain, dan Implementasi Bagian dua: Perkenalan pada Structured Query Language Bagian kedua

Menggunakan MS Access

Menggunakan MS Access (Lanjutan)

Menggunakan MS Access (Lanjutan)

Menggunakan MS Access - Hasil

Menggunakan MS SQL Server [SQL Query Analyzer]

Menggunakan Oracle [SQL*Plus]

Menggunakan Oracle [Quest Software’s TOAD]

Menggunakan MySQL [MySQL Command Line Client]

Menggunakan MySQL [MySQL Query Browser]

Sorting the Results: ORDER BY(Di urutkan dengan) SELECT * FROM ORDER_ITEM ORDER BY OrderNumber, Price;

Sort Order: Ascending and Descending SELECT * FROM ORDER_ITEM ORDER BY Price DESC, OrderNumber ASC; CATATAN : Urutan standar semacam ini ASC - tidak harus ditentukan .

WHERE Clause Options: AND SELECT * FROM SKU_DATA WHERE Department = 'Water Sports' AND Buyer = 'Nancy Meyers';

WHERE Clause Options: OR SELECT * FROM SKU_DATA WHERE Department = 'Camping' OR Department = 'Climbing';

WHERE Clause Options:- IN SELECT * FROM SKU_DATA WHERE Buyer IN ('Nancy Meyers', 'Cindy Lo', 'Jerry Martin');

WHERE Clause Options: NOT IN SELECT * FROM SKU_DATA WHERE Buyer NOT IN ('Nancy Meyers', 'Cindy Lo', 'Jerry Martin');

WHERE Clause Options: Ranges with BETWEEN SELECT * FROM ORDER_ITEM WHERE ExtendedPrice BETWEEN 100 AND 200;

WHERE Clause Options: Kisaran dengan Simbol Matematika SELECT * FROM ORDER_ITEM WHERE ExtendedPrice >= 100 AND ExtendedPrice <= 200;

WHERE Clause Options: LIKE and Wildcards SQL kunci LIKE dapat dikombinasikan dengan simbol wildcard : SQL 92 Standard ( SQL Server , Oracle , dll ) : _ = Tepat satu karakter % = Setiap set dari satu atau lebih karakter MS Access ( berdasarkan MS DOS ) ? = Tepat satu karakter * = Setiap set dari satu atau lebih karakter

WHERE Clause Options: LIKE and Wildcards (Lanjutan) SELECT * FROM SKU_DATA WHERE Buyer LIKE 'Pete%';

WHERE Clause Options: LIKE and Wildcards (Lanjutan) SELECT * FROM SKU_DATA WHERE SKU_Description LIKE '%Tent%';

WHERE Clause Options: LIKE and Wildcards SELECT * FROM SKU_DATA WHERE SKU LIKE '%2__';

Fungsi SQL Built-in Ada 5 Fungsi SQL Built-in: COUNT SUM AVG MIN MAX

SQL Built-in Functions (Lanjutan) SELECT SUM (ExtendedPrice) AS Order3000Sum FROM ORDER_ITEM WHERE OrderNumber = 3000;

SQL Built-in Functions (Lanjutan) SELECT SUM (ExtendedPrice) AS OrderItemSum, AVG (ExtendedPrice) AS OrderItemAvg, MIN (ExtendedPrice) AS OrderItemMin, MAX (ExtendedPrice) AS OrderItemMax FROM ORDER_ITEM;

SQL Built-in Functions (Lanjutan) SELECT COUNT(*) AS NumRows FROM ORDER_ITEM;

SQL Built-in Functions (Lanjutan) SELECT COUNT (DISTINCT Department) AS DeptCount FROM SKU_DATA;

Arithmetic in SELECT Statements SELECT Quantity * Price AS EP, ExtendedPrice FROM ORDER_ITEM;

Fungsi String di SELECT Statements SELECT DISTINCT RTRIM (Buyer) + ' in ' + RTRIM (Department) AS Sponsor FROM SKU_DATA;

Kata kunci SQL - GROUP BY SELECT Department, Buyer, COUNT(*) AS Dept_Buyer_SKU_Count FROM SKU_DATA GROUP BY Department, Buyer;

Kata kunci SQL - GROUP BY (Lanjutan) In general, place WHERE before GROUP BY. Some DBMS products do not require that placement, but to be safe, always put WHERE before GROUP BY. The HAVING operator restricts the groups that are presented in the result. There is an ambiguity in statements that include both WHERE and HAVING clauses. The results can vary, so to eliminate this ambiguity SQL always applies WHERE before HAVING.

Kata kunci SQL - GROUP BY (Lanjutan) SELECT Department, COUNT(*) AS Dept_SKU_Count FROM SKU_DATA WHERE SKU <> 302000 GROUP BY Department ORDER BY Dept_SKU_Count;

Kata kunci SQL - GROUP BY (Lanjutan) SELECT Department, COUNT(*) AS Dept_SKU_Count FROM SKU_DATA WHERE SKU <> 302000 GROUP BY Department HAVING COUNT (*) > 1 ORDER BY Dept_SKU_Count;

Querying Multiple Tables: Subqueries SELECT SUM (ExtendedPrice) AS Revenue FROM ORDER_ITEM WHERE SKU IN (SELECT SKU FROM SKU_DATA WHERE Department = 'Water Sports'); Catatan : Pernyataan SELECT kedua adalah subquery .

Querying Multiple Tables: Subqueries (Lanjutan) SELECT Buyer FROM SKU_DATA WHERE SKU IN (SELECT SKU FROM ORDER_ITEM WHERE OrderNumber IN (SELECT OrderNumber FROM RETAIL_ORDER WHERE OrderMonth = 'January' AND OrderYear = 2004));

Querying Multiple Tables: Joins SELECT Buyer, ExtendedPrice FROM SKU_DATA, ORDER_ITEM WHERE SKU_DATA.SKU = ORDER_ITEM.SKU;

Querying Multiple Tables: Joins (Lanjutan) SELECT Buyer, SUM(ExtendedPrice) AS BuyerRevenue FROM SKU_DATA, ORDER_ITEM WHERE SKU_DATA.SKU = ORDER_ITEM.SKU GROUP BY Buyer ORDER BY BuyerRevenue DESC;

Querying Multiple Tables: Joins (Lanjutan) SELECT Buyer, ExtendedPrice, OrderMonth FROM SKU_DATA, ORDER_ITEM, RETAIL_ORDER WHERE SKU_DATA.SKU = ORDER_ITEM.SKU AND ORDER_ITEM.OrderNumber = RETAIL_ORDER.OrderNumber;

Subqueries <=> Joins Subqueries dan Joins baik memproses beberapa tabel . Sebuah subquery hanya dapat digunakan untuk mengambil data dari tabel atas . Sebuah Joins dapat digunakan untuk memperoleh data dari sejumlah tabel , termasuk " table top " dari subquery . Dalam Bab 7 , kita akan mempelajari subquery berkorelasi. Subquery dapat melakukan pekerjaan yang tidak mungkin dilakukan Joins

David M. Kroenke’s Pengolahan Database Fundamental , Desain , dan Implementasi (10th Edition) Akhir Presentasi : Bab Dua Bagian Kedua