Postingan

Menampilkan postingan dari 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 ...

Single-Row Functions

Single-row functions return a single result row for every row of a queried table or view. These functions can appear in select lists,  WHERE  clauses,  START WITH  and  CONNECT   BY  clauses, and  HAVING  clauses. Numeric Functions Numeric functions accept numeric input and return numeric values. Most numeric functions return  NUMBER  values that are accurate to 38 decimal digits. The transcendental functions  COS ,  COSH ,  EXP ,  LN ,  LOG ,  SIN ,  SINH ,  SQRT ,  TAN , and  TANH  are accurate to 36 decimal digits. The transcendental functions  ACOS ,  ASIN ,  ATAN , and  ATAN2  are accurate to 30 decimal digits. The numeric functions are: ABS ACOS ASIN ATAN ATAN2 BITAND CEIL COS COSH EXP FLOOR LN LOG MOD NANVL POWER REMAINDER ROUND (number) SIGN SIN SINH SQRT TAN TANH TRUNC (number) WIDTH_BUCKET Character Functions Returning Character Value...