Skip to content

Introduction to SQL

SQL (Structured Query Language) is a standardized language used to manage and manipulate relational databases. SQL allows you to:

  • Query Data: Retrieve specific information from large datasets.
  • Insert Data: Add new records to the database.
  • Update Data: Modify existing data.
  • Delete Data: Remove records from the database.


What is PostgreSQL?

PostgreSQL is an open-source, powerful relational database management system (RDBMS) that supports advanced SQL features. It is known for:

  • ACID compliance: Ensures reliable transactions (Atomicity, Consistency, Isolation, Durability).
  • Support for JSON and Array data types.
  • Extensibility: Custom functions, data types, etc.


Relational Database Concepts

  • Tables: A table is like a spreadsheet where data is organized into rows and columns.
  • Rows: Each row represents a single record.
  • Columns: Each column represents a specific attribute of the data.

Example: A Chai table with the following columns: id, name, ingredients, price, city_sold.

...
| id | name | ingredients | price | city_sold |
|-----|--------------|------------------------|-------|-----------|
| 1 | Masala Chai | Tea, Milk, Spices | 50 | Mumbai |
| 2 | Assam Chai | Assam Tea, Milk, Sugar | 40 | Delhi |
...

Summary

In this chapter we have learned about SQL and PostgreSQL. We have also learned about relational databases and their concepts. By the end of this chapter, you should have a good understanding of SQL and how it can be used to manage and manipulate relational databases.

Start your journey with ChaiCode

All of our courses are available on chaicode.com. Feel free to check them out.