{"id":50,"date":"2018-12-04T17:07:48","date_gmt":"2018-12-04T17:07:48","guid":{"rendered":"https:\/\/barkhane.com\/sql\/2018\/12\/04\/types-of-sql-commands\/"},"modified":"2024-03-03T18:07:10","modified_gmt":"2024-03-03T18:07:10","slug":"types-of-sql-commands","status":"publish","type":"post","link":"https:\/\/barkhane.com\/sql\/types-of-sql-commands\/","title":{"rendered":"Types of SQL Commands"},"content":{"rendered":"<h2>Types of SQL Commands<\/h2>\n<p>Types of SQL Commands: SQL to perform various functions include building database objects, manipulating objects, populating database tables with data, updating existing data in tables, deleting data, performing database queries, controlling database access, and overall database administration.<\/p>\n<blockquote><p>The main categories are<\/p>\n<ul>\n<li>DDL (Data Definition Language)<\/li>\n<li>DML (Data Manipulation Language)<\/li>\n<li>DQL (Data Query Language)<\/li>\n<li>DCL (Data Control Language)<\/li>\n<li>Data administration commands<\/li>\n<li>Transactional control commands<\/li>\n<\/ul>\n<\/blockquote>\n<h3>Defining Database Structures<\/h3>\n<p>Data Definition Language, DDL, is the part of SQL that allows a database user to create and restructure database objects, such as the creation or the deletion of a table.<\/p>\n<p>Some of the most fundamental DDL commands discussed during following hours include the following:<\/p>\n<ul>\n<li>CREATE TABLE<\/li>\n<li>ALTER TABLE<\/li>\n<li>DROP TABLE<\/li>\n<li>CREATE INDEX<\/li>\n<li>ALTER INDEX<\/li>\n<li>DROP INDEX<\/li>\n<li>CREATE VIEW<\/li>\n<li>DROP VIEW<\/li>\n<\/ul>\n<h3>Manipulating Data<\/h3>\n<p>Data Manipulation Language, DML, is the part of SQL used to manipulate data within objects of a relational database.<\/p>\n<p>There are three basic DML commands:<\/p>\n<ul>\n<li>INSERT<\/li>\n<li>UPDATE<\/li>\n<li>DELETE<\/li>\n<\/ul>\n<h3>Selecting Data<\/h3>\n<p>Though comprised of only one command, Data Query Language (DQL) is the most concentrated focus of SQL for modern relational database users. The base command is as follows:<\/p>\n<p>SELECT<\/p>\n<p>This command, accompanied by many options and clauses, is used to compose queries against a relational database. Queries, from simple to complex, from vague to specific, can be easily created.<\/p>\n<p>A\u00a0query\u00a0is an inquiry to the database for information. A query is usually issued to the database through an application interface or via a command line prompt.<\/p>\n<h3>Data Control Language<\/h3>\n<p>Data control commands in SQL allow you to control access to data within the database. These DCL commands are normally used to create objects related to user access and also control the distribution of privileges among users. Some data control commands are as follows:<\/p>\n<ul>\n<li>ALTER PASSWORD<\/li>\n<li>GRANT<\/li>\n<li>REVOKE<\/li>\n<li>CREATE<\/li>\n<li>SYNONYM<\/li>\n<\/ul>\n<h3>Data Administration Commands<\/h3>\n<p>Data administration commands allow the user to perform audits and perform analyses on operations within the database. They can also be used to help analyze system performance. Two general data administration commands are as follows:<\/p>\n<ul>\n<li>START AUDIT<\/li>\n<li>STOP AUDIT<\/li>\n<\/ul>\n<p>Do not get data administration confused with database administration.\u00a0Database administration\u00a0is the overall administration of a database, which envelops the use of all levels of commands.\u00a0Database administration\u00a0is much more specific to each SQL implementation than are those core commands of the SQL language.<\/p>\n<h3>Transactional Control Commands<\/h3>\n<p>In addition to the previously introduced categories of commands, there are commands that allow the user to manage database transactions.<\/p>\n<ul>\n<li>COMMIT\u00a0Saves database transactions<\/li>\n<li>ROLLBACK\u00a0Undoes database transactions<\/li>\n<li>SAVEPOINT\u00a0Creates points within groups of transactions in which to\u00a0ROLLBACK<\/li>\n<li>SET TRANSACTION\u00a0Places a name on a transaction<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Types of SQL Commands Types of SQL Commands: SQL to perform various functions include building database objects, manipulating objects, populating [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[2],"tags":[],"class_list":["post-50","post","type-post","status-publish","format-standard","hentry","category-sql"],"_links":{"self":[{"href":"https:\/\/barkhane.com\/sql\/wp-json\/wp\/v2\/posts\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/barkhane.com\/sql\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/barkhane.com\/sql\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/barkhane.com\/sql\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/barkhane.com\/sql\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":0,"href":"https:\/\/barkhane.com\/sql\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"wp:attachment":[{"href":"https:\/\/barkhane.com\/sql\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/barkhane.com\/sql\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/barkhane.com\/sql\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}