Now that we know how SQL works in a database system, it is now time to learn what sql commands (code) we need to write for specific operations.
As we said in our previous post, SQL gives you complete power over your data. But what does this mean exactly? We have many types of commands which allow you to do different operations with your data.
SQL Commands
These types of SQL Commands are of different nature, depending on the type of action they perform in the database:
Data definition language (DDL):
The SQL Commands that are part of this group are:
-
CREATE
– used to create new tables or any other object in the database -
ALTER
– used to modify the structure of a table or any object in the database -
DROP
– used to completely delete an object from the database
Data manipulation language (DML):
-
INSERT
– used to insert new data in the database -
UPDATE
– used to modify any existing data in the database -
DELETE
– used to delete any data from the database
Data control language (DCL):
-
GRANT
– is used to give users access to different permissions -
REVOKE
– is the opposite of GRANT, it denies users access to certain features
Data Query Language (DQL):
-
SELECT
– this basic command is used to retrieve information from the database
The power is yours
All of these SQL commands will help you in developing a database system where you can store and manipulate all of your data.
Also, if you consider your stored data needs modifying (updating), then you also have the power of doing this.
Depending on your RDBMS, you have the possibility to set access levels to your data, creating a layer of security between you and other people that might be interested in the data you are storing.
Thus, as we’ve said before, SQL gives you complete power over your data, where/how you store it, who has access to it, and who can modify it.
Many types of SQL
We’ve said in our previous articles, that there are more dialects of SQL, depending on what database system (RDBMS) is queried for data.
We just presented the basic commands here, that will work on any RDBMS, but their exact syntax might be different if you’re looking for more extensive options.
Thus, the most common RDBMS systems and their SQL dialects are:
- SQL Server – query with T-SQL or Transact-SQL
- Oracle – query with PL/SQL or Procedural Language/SQL
- PostgreSQL – query with PL/pgSQL or Procedural Language/PostgreSQL (based on Oracle PL/SQL)
- MySQL – query with SQL/PSM or SQL/Persistent Stored Module
Very useful
Thanks