SQL
The databases that use the SQL syntax are called Relational databases. Popular examples are:
- MySQL
- PostgreSQL
- SQLite
Relational databases use SQL to read, create, update and delete data.
The name comes from the way that data is stored in multiple, related tables. Within the tables, data is stored in rows and columns.
What is SQL?
SQL stands for Structured Query Language, as it is the special purpose language for querying data in Relational Databases.
MySQL, PostgreSQL, SQLite all use SQL for querying with slight syntax differences.
Basic SQL commands
-
Select
This component was made by Stratis Dermanoutsos. The code can be found here. -
Update
This component was made by Stratis Dermanoutsos. The code can be found here. -
Delete
This component was made by Stratis Dermanoutsos. The code can be found here. -
Insert
This component was made by Stratis Dermanoutsos. The code can be found here. -
Create database
This component was made by Stratis Dermanoutsos. The code can be found here. -
Drop database
This component was made by Stratis Dermanoutsos. The code can be found here. -
Create table
This component was made by Stratis Dermanoutsos. The code can be found here. -
Alter table
This component was made by Stratis Dermanoutsos. The code can be found here. -
Drop table
This component was made by Stratis Dermanoutsos. The code can be found here.
SQL JOIN
As the name implies, relational databases have related data. In other words, we can join our tables to present these related data together.
-
(INNER) JOIN
Returns records that have matching values in both tables.
-
LEFT (OUTER) JOIN
Returns all records from the left table, and the matched records from the right table.
-
RIGHT (OUTER) JOIN
Returns all records from the right table, and the matched records from the left table.
-
FULL (OUTER) JOIN
Returns all records when there is a match in either left or right table.
Useful snippets
-
Functional index
This component was made by Stratis Dermanoutsos. The code can be found here.Now, the same expression will be
This component was made by Stratis Dermanoutsos. The code can be found here.