What is SQL?
SQL stands for structured query language and as the name says this language is used for query data from databases, it was created by IBM, and also it works with relational databases. so... ¿what is the basic schema of the database's functionality? how a database works? ok let's say that we have a server or a computer where we have a database and if we want to query data from database to server or computer we need to use SQL, depending on what we want to do, we need to specify that instruction by means of a SQL statement, the computer or server will read the statement and they will process the information to the database and finally that information will be represented in data. But we need to know something important, that system that has a database is a database management system (DBMS).
SQL Standard
All the DBMS use SQL like the standard language for manage data, there a lot of DBMS and many of them work with remote systems like MySQL, Microsoft SQL Server, etc, and also many of them work with a local system like access and remote service means that it is on internet, for other part local means to work in the computer but actually already there are DBMS that work with their own SQL dialect what means this? this means that sometimes a DBMS can have different syntax but that is not a big problem because they have SQL just that a little different and the thing is that all DBMS have SQL-like standard system for communication with databases.
additional information: There is an official SQL standard called ansiSQL that is the standard system used for all the DBMS
SQL Commands
SQL not only can query data... it can insert, manipulate, delete and manage all the data that is in a database so we can classify commands that a database set in 4 groups:
-Data Definition Language (DDL)
This group of commands defines the schema of a database with commands like create for creating new tables, fields, and index, truncate for truncate a complete database, drop for drop tables and indexes, alter for alter a table adding new fields.
-Data Manipulation Language (DML)
This group of commands can manipulate all the data inside a database with commands like insert for insert new registers in a DDBB, select for display data in a database, update for modifying new data, and delete for delete data.
-Data Control Language (DCL)
This group of commands is used to control the security of a database, commands are revoke for revoke access to data and grant for grant access to data.
-Transaction Control Language (TCL)
Used for manage data changes, commands are: Commit, Rollback and Savepoint
Clauses
Clauses are instructions that go after a command, we have From, Where, Group by, Having, and Order by; This is the order that we have to follow when we work with clauses.
SQL Statement
When we work with SQL we need to follow an order to write a statement, the order is Command + Clause + Operators + Functions, it is not necessary to write a statement with operators, functions, and clauses, all depends on what we want to query or the complex.