Skip to content

Linux Fun

Artikel seputar linux, teknik informatika dan sistem informasi

Menu
  • About
  • Contact
  • Disclaimer
  • Privacy Policy
  • Sitemap
Menu

SQL DATA MANIPULATION LANGUAGE (DML)

Posted on March 13, 2013 by linuxfun

The DML component of SQL is the part that is used to query and update the tables (once they are built via DDL commands or other means). By far, the most commonly used DML statement is the SELECT.  It combines a range of functionality into one complex command.

Used primarily to retrieve data from the database.  Also used to create copies of tables, create views, and to specify rows for updating.

General Format: Generic overview applicable to most commercial SQL implementations – lots of potential combinations.  There are several variations available in Oracle.

SELECT {field-list | * | ALL | DISTINCT | expression}
FROM table-list
WHERE expression
GROUP BY group-fields
HAVING group-expression
ORDER BY field-list;

Only the SELECT and the FROM clauses are required.  The others are optional.

  • 1 FROM
  • 2 WHERE
  • 3 GROUP BY
  • 4 HAVING
  • 5 ORDER BY

FROM

A required clause that lists the tables that the select works on.  You can define “alias” names with this clause to speed up query input and to allow recursive “self-joins”.

WHERE

An optional clause that selects rows that meet the stated condition.  A “sub-select” can appear as the expression of a where clause.  This is called a “nested select”.

GROUP BY

An optional clause that groups rows according to the values in one or more columns and sorts the results in ascending order (unless otherwise specified).  The duplicate rows are not eliminated, rather they are consolidated into one row.  This is similar to a control break in traditional programming.

HAVING

An optional clause that is used with GROUP BY.  It selects from the rows that result from applying the GROUP BY clause.  This works the same as the WHERE clause, except that it only applies to the output of GROUP BY.

ORDER BY

An optional clause that sorts the final result of the SELECT into either ascending or descending order on one or more named columns.

There can be complex interaction between the WHERE, GROUP BY, and HAVING clauses.  When all three are present the WHERE is done first, the GROUP BY is done second, and the HAVING is done last.

Example 1: Select all employees from the ‘ACCT’ department.
SELECT * FROM EMPLOYEES WHERE EMP-DEPT = ‘ACCT’;

Example 2: Show what salary would be if each employee recieved a 10% raise.
SELECT LNAME, SALARY AS CURRENT, SALARY * 1.1 AS PROPOSED FROM EMPLOYEES;

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Sifat-Sifat Benda, Pengenalan Sifat Fisik dan Sifat Kimia
  • Konsep dan Pengertian Teori Keseimbangan Umum
  • Database Oracle
  • Perpajakan, Fungsi, Tujuan, dan Sistem Perpajakan di Indonesia
  • Teori Konsumen, Memahami Perilaku Konsumen dalam Memilih Barang dan Jasa
  • Asimetri Informasi, Perilaku Agen, Moral Hazard, Adverse Selection dan Pasar Asuransi
  • Memahami Konsep Penting dalam Ekonomi Perusahaan dan Industri, Pengambilan Keputusan, Teori Pasar, Investasi, dan Strategi Perusahaan
  • Mempelajari Konsep Keseimbangan Umum, Interaksi Pasar Barang dan Faktor Produksi serta Peran Pemerintah dalam Perekonomian
  • Efisiensi Pasar dan Peran Pemerintah dalam Meningkatkan Kesejahteraan Masyarakat, Memahami Konsep-konsep dalam Ekonomi Kesejahteraan
  • Eksternalitas dan Public Goods, Mempelajari eksternalitas, manfaat publik, biaya dan manfaat sosial, dan peran pemerintah dalam mengatasi pasar yang tidak sempurna
  • Analisis Pasar Monopoli, Memahami Monopoli, Persaingan Monopolistik, Oligopoli, Kartel, dan Pengaruhnya Terhadap Harga dan Kualitas Produk atau Jasa

Categories

  • Adobe
  • Alga
  • Algoritma
  • Algoritma Genetika
  • Android
  • Basis Data
  • Biologi SMA Kelas 10
  • Biometrik
  • Borland Delphi
  • Buku Pelajaran SMA
  • Buku Pelajaran SMK
  • Buku Pelajaran SMP
  • Business Intelligence
  • C++
  • Cacing
  • Citra Digital
  • Clustering
  • Customer Relationship Management
  • Data Flow Diagram
  • Data Mining
  • Data Warehouse
  • Database Terdistribusi
  • Databases
  • Desain Grafis
  • Ekonomi
  • Ekonomi Makro
  • Ekonomi Micro
  • Ekonomi SMA Kelas 12
  • Enterprise Resource Planning
  • Entity Relationship Diagram
  • Financial Management
  • Fuzzy
  • Game
  • Ganggang
  • Globalisasi
  • Hewan
  • Hidden Markov Model
  • Ilmu Pengetahuan Sosial SMP Kelas 9
  • Internet
  • Invertebrata
  • Jamur
  • Java
  • Keanekaragaman Hayati
  • Kebijakan Publik
  • Kecerdasan Buatan
  • Klasifikasi Makhluk Hidup
  • Knowledge Management
  • Komputer
  • Koperasi
  • Kriptografi
  • Logika Informatika
  • Manajemen
  • Manajemen Badan Usaha
  • Manajemen Proyek Sistem Informasi
  • Microsoft Acces
  • Monera
  • Multimedia
  • My SQL
  • Negara Berkembang
  • Negara Maju
  • Network Management
  • Otonomi Daerah
  • Pascal
  • Pelajaran IPA SMP Kelas 1
  • Pembelaan Negara
  • Pendidikan Kewarganegaraan SMP Kelas 9
  • Pengenalan Pola
  • Penutupan Siklus Akuntansi
  • Perang Dunia II
  • Perpajakan
  • PHP
  • PLC
  • Prestasi Diri
  • Protista
  • Prototype
  • Rekayasa Perangkat Lunak
  • Siklus Akuntansi Perusahaan Dagang
  • Sistem Informasi
  • Sistem Informasi Geografis
  • Sistem Kelistrikan
  • Sistem Pakar
  • Sistem Pendukung Keputusan
  • Sistem Pengapian
  • SMS Gateway
  • SQL Server
  • Teknik Sepeda Motor SMK Kelas 11
  • Teori Ekonomi
  • Thyristor
  • Tingkatan Manajemen
  • Tumbuhan
  • UML
  • Uncategorized
  • Vertebrata
  • Video
  • Virus
  • Visual Basic
© 2023 Linux Fun