πŸ“˜ SQL Blog Series - Day-2

 In the previous blog, we explored what SQL is and why it’s such an essential part of every application. We also understood how SQL connects with different programming languages and frameworks to manage data effectively.

Today, let’s dive a bit deeper and begin our actual SQL journey. We’ll start by learning about databases, tables, and some basic SQL commands that form the foundation of everything we do in SQL.


πŸ—️ What is a Database?

A database is like the main storage base that holds all our data in an organized way. Think of it as a big container where all your information is stored safely. Inside a database, data isn’t just scattered around — it’s neatly arranged in the form of tables.

Each database can have multiple tables, and each table stores data related to a specific topic or entity — like customers, employees, products, or orders.


🧩 SQL Data Types

When we create tables in SQL, every column needs to store a specific kind of data — numbers, text, dates, or even true/false values. To make sure the data stays consistent and accurate, SQL provides different data types.

Here are some of the most commonly used SQL data types:

Data Type DescriptionExample
INT             Used to store whole numbers.        101, 5000
VARCHAR(n)    Stores variable-length text (up to n characters).    'John Doe'
CHAR(n)    Stores fixed-length text (exactly n characters).    'ABC'
DATE             Used to store calendar dates.    '2025-10-10'
FLOAT / DECIMAL     Used for decimal or floating-point numbers.    99.99
BOOLEAN             Stores true/false values.    TRUE / FALSE

Each database system (like MySQL, PostgreSQL, or SQL Server) might have slight variations, but the core concept remains the same — every column must have a defined data type so SQL knows how to handle that data.


⚙️ Basic SQL Commands

Now that we understand databases, tables, and data types, let’s learn some of the most commonly used SQL commands. These commands help us create, manage, and remove databases or tables.

πŸ—️ 1. CREATE DATABASE

This command is used to create a new database.

This creates a new database named company_db.


πŸ’Ύ 2. USE

Once the database is created, we use this command to select which database we want to work with.

                                

This tells SQL to perform all upcoming operations inside company_db.


πŸ“‹ 3. CREATE TABLE

We use this command to create a new table inside a database.



This creates a table named employees with three columns: id, name, and salary.


πŸ—‘️ 4. DROP DATABASE

This command is used to delete an entire database permanently.


⚠️ Be careful! Once dropped, all tables and data inside the database are gone forever.


🧹 5. DROP TABLE

This command is used to delete a specific table from the database.

`


This removes only the employees table, not the entire database.


“Before you query the data, learn to create the space where it lives.”

Comments

Popular posts from this blog

Welcome to Python Fun Zone: Learn, Code, Build!

Day 1: Getting Started with Python – A Friendly Introduction for Beginners

Day 2: Variables and Data Types – The Building Blocks of Python 🐍