Introduction to SQL
What is Database
- A “Database” is a “Collection” of “Data” and “Holds” the “Data” in the “Form” of “Tables”.
- Apart from “Storing” the “Data”, a “Database” also provides the “Capability” to “Access” and “Manipulate” the “Stored Data”.
What is Table
- A “Table” is an “Entity” that “Holds” the “Data” in the “Form” of “Rows” and “Columns”.
- A “Table” is similar to an “Excel Spreadsheet”.
Different Types of Databases
Mostly the Databases can be “Grouped” into “Two” Categories. Hence, there are two “Types” of “Databases” -
A. Relational Database - A “Relational Database” is the one, in which the “Data” is “Stored” in the “Form” of the “Rows” and “Columns”, i.e., in “Tables”.
Also, “Multiple Tables” can have “Relations” between them. Example - in a “Database”, there can be Three “Tables”:
i) Order
ii) Customer
iii) Product
An “Order” Table can have “OrderID”. That particular “OrderID” would have been ordered by a Customer, having a “CustomerID” in the “Customer” Table. Also, that particular “OrderID” would have multiple “ProductID” from the “Produtct” Table. This is how the “Order”, “Customer” and “Product” Tables are “Related” with each other.
Examples of “Relational Databases” are:
- MySQL
- SQL Server
- PostgreSQL
- SQLite
- MariaDB
B. Non-Relational Database, or NoSQL Database - A “Non-Relational Database”, or a “NoSQL Database” is the one, in which the “Data” can be “Stored” in the “Form” of:
- As a “Key-Value Pair”, or
- As a “Document”, or
- As a “Graph” etc.
In a “Non-Relational Database”, or a “NoSQL Database”, each “Table” is “Different” and “Does Not” have any “Relation” with each other.
Examples of “Non-Relational Databases”, or “NoSQL Databases” are:
- HBase
- MongoDB
- Cassandra
What is SQL
“SQL” stands for “Structured Query Language”. Through “SQL”, the “Users” can “Interact With” the “Relational Databases”.
“SQL Queries” are used to -
- “Insert” the “Data”
- “Update” the “Record”
- “Retrieve” the “Record”, and so on.
This “Language” is “Called” such because this is used to “Deal With” the “Structured Data”, which is in the “Form” of “Rows” and “Columns”.