What is SQL
SQL is the computer language to manage data in the RDBMS system. SEQUEL, Structured English Query Language was the first developed computer language to work with database systems, it was renamed to SQL Structured Query language as there existed a corporation with the same trademark in England. SQL language is non procedural language developer for relational database management systems.
DML Data Manipulation Language:
These are the group of SQL statements manages the addition, updating and deletion of data in the database.
• Insert - to insert data into the table
• Update - to alter or update the value already entered into the table
• Delete - to remove data from the table
• Truncate - deletes all data from a table quickly
• Merge - similar to Upsert logic, combines the function of Insert and Update to combine data from multiple tables
DDL or Data Definition Language:
These are the group of SQL statements to manage and index the table structure of the database.
• Create – creates a table in the database
• Drop – drops a table from the database
• Alter – rename a column or add a column to existing table
DCL or Data Control Language:
These are the group of SQL statements to control the access to data by allowing rights or revoking access to the user for the database objects.
• Grant
• Revoke
Transaction Control Statements:
These are the group of SQL statements that enable transactional database functions.
• Commit – If the SQL statements are successful, confirms the changes to the database.
• Roll back – If the SQL statements fail, go to the state of the database before the failed SQL statements begin to execute.
SQL Clauses:
The SQL statements uses the
• From – A clause to indicate from which table the data is to be retrieved
• Where – A clause incorporates the criteria or condition for the number of rows to be retrieved
• Group by – A clause to perform aggregations or elimination as well as clause to produce smaller result sets applying on rows having common values.
• Having – A clause acts on the group by clause. Having clause restricts the number of rows returned by the group by clause.
• Order By – A clause to identify the columns used to sort the resulting data.
Examples:
The below SQL statements are executed on the tables here on the tables called Customer_Sales & Customer_Master.
1. Select * from Customer_Master where customer_ID = 101
This statement retrieve all the records having customer_ID =101
2. Select customer_ID, sum (sales_amount) as total from Customer_Sales group by customer_ID
This statement retrieves the sum of all the sales_amount for each customer.
Customer_ID - Total
101 - 33789
102 - 45000
103 - 25345
Related posts:
- Relational Database Relational Database, the data or information are gathered and arranged...
- What is Database Database is an integrated collection of logically related data or...
- Database Trigger Database Triggers are set of actions written in the code...
- De Normalisation De Normalisation (or De Normalization) of data allows table to...
- OLAP vs OLTP If you are into databases and middleware and ever wodners...
No Responses to “What is SQL”
No feedback yet.