Class-26

 

πŸ“Œ What is SQL?

  • SQL (Structured Query Language) is used to retrieve, update, and manage data in a database.
  • Essential for data analysts, data scientists, business analysts, and developers.
  • SQL is easy to learn and widely used.

πŸ“Œ Databases & Database Management Systems (DBMS)

  • A database consists of tables storing structured data (rows & columns).
  • PostgreSQL is a powerful and popular open-source DBMS.
  • pgAdmin is a GUI for PostgreSQL to help interact with the database.

πŸ“Œ SQL Commands Learned Today

1️⃣ SELECT → Retrieve specific columns from a table.

SELECT column_name FROM table_name;

2️⃣ ORDER BY → Sort results in ascending (ASC) or descending (DESC) order.

SELECT column_name FROM table_name ORDER BY column_name DESC;

3️⃣ DISTINCT → Remove duplicates from results.

SELECT DISTINCT column_name FROM table_name;

4️⃣ LIMIT → Restrict the number of rows returned.

SELECT column_name FROM table_name LIMIT 10;

5️⃣ COUNT → Count the number of rows.

SELECT COUNT(*) FROM table_name;  -- Total rows  
SELECT COUNT(column_name) FROM table_name;  -- Non-null values  
SELECT COUNT(DISTINCT column_name) FROM table_name;  -- Unique values  

πŸ“Œ Key Takeaways

βœ… SQL helps us efficiently retrieve and analyze data.
βœ… PostgreSQL + pgAdmin is a great setup for learning SQL.
βœ… Sorting, filtering, and counting data are foundational SQL skills.
βœ… We now have a strong base for more advanced topics.


Excited for tomorrow’s lessons? πŸš€ Keep practicing these concepts, and let me know if you need any clarifications! 😊


Was this article helpful?