Skip to content

Instantly share code, notes, and snippets.

@sandheepg
Created July 28, 2017 13:19
Show Gist options
  • Save sandheepg/d5f4530509621c098db2ed266c45837e to your computer and use it in GitHub Desktop.
Save sandheepg/d5f4530509621c098db2ed266c45837e to your computer and use it in GitHub Desktop.
SQL Commands Definition
Data definition
CREATE - Creates a new database or a table.  
ALTER - Modifies the structure of a database or a table.  
DROP - Deletes a database or a table.  
TRUNCATE - Removes all table records, including allocated table spaces.  
Data manipulation
SELECT - Retrieve data from the table.  
INSERT - Insert data into a table.  
UPDATE - Updates the existing data with new data within a table.  
DELETE - Deletes the records from the table.  
MERGE - Merge statements to INSERT new records or UPDATE  existing records depending on condition matches or not.  
Data control
GRANT - Gives privileges to a user for accessing database data.  
REVOKE - Removes the given privileges.  
ANALYZE - Recomputes various statistics(information about index, cluster, table, etc) that RDBMS uses to plan its database queries.  
AUDIT - Tracks the occurrence of a specific SQL statement or all SQL statements during the user sessions.  
COMMENT - Writes comment to the data table.  
Transaction control
SAVEPOINT - Defines a new save point and asks the server to remember the current state of the transaction within the current transaction.  It could be later used to Rollback the new changes.  
COMMIT - All the elements of the transaction are completed and should now be made persistent and accessible to all concurrent and subsequent transactions.  
ROLLBACK - Cancels all changes made to data by that SQL transaction.  
SET TRANSACTION - Changes the Isolation level of the transaction (e.g. READ COMMITTED | SERIALIZABLE)  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment