Postingan

Menampilkan postingan dari Desember, 2017

Fungsi Join Pada SQL Oracle

Gambar
Join merupakan penggambaran relasi yang terjadi antar suatu tabel dengan tabel lainya. Pada Oracle ada beberapa fungsi Join diantaranya adalah : - Natural Joins - Using Clause - On Clause - Full ( two-sided) outer joins Natural Joins Natural Joins digunakan untuk menampilkan fungsi join secara natural. Ada beberapa ketentuannya yakni nama harus sama, value harus sama dan tipe data harus sama. select department_id,department_name,location_id as Lokasi,city from departments  natural join locations Using Clause Using Clause digunakan untuk memodifikasi fungsi natural join jika terdapat kolom yang memiliki nama yang sama tetapi memiliki tipe data yang berbeda. select employees.employee_id,employees.last_name,departments.location_id,department_id  from employees  join departments using (department_id) On Clause On Clause digunakan untuk menentukan kolom yang memiliki spesifikasi tertentu yang akan digunakan untuk fungsi join. select e.las...

GROUP Functions

GROUP Functions Group functions are built-in SQL functions that operate on groups of rows and return one value for the entire group. These functions are:  COUNT, MAX, MIN, AVG, SUM, DISTINCT SQL COUNT ():  This function returns the number of rows in the table that satisfies the condition specified in the WHERE condition. If the WHERE condition is not specified, then the query returns the total number of rows in the table. For Example:  If you want the number of employees in a particular department, the query would be: SELECT COUNT (*) FROM employee  WHERE dept = 'Electronics';  The output would be '2' rows. If you want the total number of employees in all the department, the query would take the form: SELECT COUNT (*) FROM employee; The output would be '5' rows. SQL DISTINCT():  This function is used to select the distinct rows. For Example:  If you want to select all distinct department names from employee table, the query would ...