4 min read

Basic SQL Commands: Complete Beginner Guide

If you're starting your journey into databases, learning basic SQL or MySQL commands is the first and most important step. SQL (Structured Query Language) is the standard language used to interact with databases. MySQL is one of the most popular database management systems that uses SQL.

Whether you're a developer, student, or aspiring data analyst, understanding SQL basics will help you manage data efficiently, build applications, and work with real world databases.

In this complete guide, you'll learn:

  • What SQL and MySQL are

  • How to install and set up MySQL

  • Essential SQL commands with practical examples

  • Common mistakes beginners make

  • Benefits of learning SQL

  • Frequently asked questions (People Also Ask style)

Let’s get started.

What is SQL?

SQL (Structured Query Language) is a programming language used to:

  • Create databases

  • Store data

  • Retrieve data

  • Update records

  • Delete records

  • Manage database permissions

SQL works with relational databases, which store data in tables.

Popular database systems that use SQL include:

  • MySQL

  • PostgreSQL

  • Microsoft SQL Server

  • Oracle Database

What is MySQL?

MySQL is an open source relational database management system (RDBMS) that uses SQL as its query language.

It is widely used in:

  • Web development

  • Content management systems

  • E-commerce platforms

  • Enterprise applications

MySQL is known for its speed, reliability, and ease of use.

How to Install and Set Up MySQL

On Ubuntu/Linux

Follow this article to install on Ubuntu How to Install MySQL.

On Windows

  1. Go to the official MySQL website.

  2. Download MySQL Installer.

  3. Run the installer.

  4. Choose "Developer Default".

  5. Set a root password.

  6. Complete installation.

Basic SQL/MySQL Commands (With Practical Examples)

Let’s explore the most important SQL commands every beginner should know.

1. CREATE DATABASE

Creates a new database.

CREATE DATABASE school;

Use it:

USE school;

2. CREATE TABLE

Creates a table inside a database.

CREATE TABLE students (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100),
    age INT,
    grade VARCHAR(10)
);

3. INSERT INTO

Adds data to a table.

INSERT INTO students (name, age, grade)
VALUES ('geekdas', 18, 'A');

Insert multiple rows:

INSERT INTO students (name, age, grade)
VALUES 
('Anita', 19, 'B'),
('geekdas', 17, 'A');

4. SELECT

Retrieves data from a table.

SELECT * FROM students;

Select specific columns:

SELECT name, grade FROM students;

With condition:

SELECT * FROM students WHERE grade = 'A';

5. UPDATE

Updates existing records.

UPDATE students
SET grade = 'A+'
WHERE name = 'geekdas';

6. DELETE

Deletes records from a table.

DELETE FROM students
WHERE name = 'geekdas';

IMPORTANT: Always use "WHERE" with DELETE to avoid removing all records.

7. DROP

Deletes database or table permanently.

DROP TABLE students;

Or:

DROP DATABASE school;

IMPORTANT: Be careful - this cannot be undone.

8. ALTER TABLE

Modifies table structure.

Add a column:

ALTER TABLE students
ADD email VARCHAR(100);

9. ORDER BY

Sorts results.

SELECT * FROM students
ORDER BY age DESC;

10. LIMIT

Limits number of results.

SELECT * FROM students
LIMIT 5;

Practical Real World Example

Let’s say you're building a simple CRM system.

Create database:

CREATE DATABASE crm;
USE crm;

Create a customers table:

CREATE TABLE customers (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100),
    email VARCHAR(100),
    city VARCHAR(50)
);

Insert customers:

INSERT INTO customers (name, email, city)
VALUES ('geekdas', 'dev.geekdas@email.com', 'Delhi');

Find customers from Delhi:

SELECT * FROM customers WHERE city = 'Delhi';

This is how real applications use SQL behind the scenes.

Common Mistakes Beginners Make

Here are typical SQL mistakes to avoid:

1. Forgetting WHERE Clause in DELETE or UPDATE

Wrong:

DELETE FROM students;

This deletes everything.

2. Case Sensitivity Confusion

Table names may be case sensitive on Linux servers.

3. Not Using Primary Keys

Always define a "PRIMARY KEY" to uniquely identify records.

4. Ignoring Data Types

Using wrong data types (like storing numbers as VARCHAR) causes performance issues.

5. Not Backing Up Before DROP

Always backup your database before running destructive commands.

Benefits of Learning Basic SQL/MySQL Commands

Learning SQL offers many advantages:

1. High Demand Skill

SQL is required in software development, data analysis, and backend engineering.

2. Works with Most Databases

SQL is universal across systems.

3. Easy to Learn

Compared to programming languages, SQL syntax is simple and readable.

4. Required for Web Development

If you use PHP, Node.js, Python, or Java, you’ll interact with databases using SQL.

5. Career Opportunities

Jobs like:

  • Database Administrator

  • Backend Developer

  • Data Analyst

  • Data Engineer

All require SQL knowledge.

Conclusion

Learning basic SQL or MySQL commands is the foundation of working with databases. From creating databases to retrieving and updating records, SQL enables you to manage structured data effectively.

Start by practicing:

  • CREATE

  • INSERT

  • SELECT

  • UPDATE

  • DELETE

Once you’re comfortable with these commands, you can move toward advanced topics like joins, indexing, stored procedures, and optimization.

The best way to master SQL? Practice daily.

Frequently Asked Questions

What are the basic SQL commands every beginner should know?
The most important SQL commands are CREATE, INSERT, SELECT, UPDATE, DELETE, DROP, ALTER, ORDER BY, and LIMIT. These allow you to manage and manipulate data in a database.
Is SQL and MySQL the same?
No. SQL is a query language, while MySQL is a database management system that uses SQL to interact with data.
How long does it take to learn basic SQL?
Most beginners can learn basic SQL commands within 1–2 weeks with consistent practice.
Can I learn SQL without programming knowledge?
es. SQL is beginner friendly and does not require prior programming experience.
What is the difference between DELETE and DROP in SQL?
DELETE removes records from a table, while DROP deletes the entire table or database structure permanently.
Is MySQL free to use?
Yes, MySQL Community Edition is free and open source.
Where is SQL used in real life?
SQL is used in websites, banking systems, e-commerce platforms, CRM software, analytics systems, and enterprise applications.

Related Articles