📍 Lawyer Pet Ext., Ongole, AP 📞 +91 9848517191 ✉️ support@kkccinfo.com
Database Mastery

MySQL Database Complete Manual & Queries

Relational DB Design, SQL DDL, DML, DQL Queries, Inner/Outer Joins, Aggregation & Indexing.

1. RDBMS Concepts & Architecture

MySQL is an open-source Relational Database Management System (RDBMS) that stores structured data in tables consisting of rows and columns. Relationships between tables are enforced via Primary Keys and Foreign Keys.

SQL SublanguageCommandsPurpose
DDLCREATE, ALTER, DROP, TRUNCATEDefines schema structure and tables
DMLINSERT, UPDATE, DELETEManipulates data records inside tables
DQLSELECTQueries and retrieves formatted data
TCLCOMMIT, ROLLBACK, SAVEPOINTManages database transaction boundaries

2. DDL & DML Command Examples

SQL Schema Creation
-- Create Database & Students Table
CREATE DATABASE IF NOT EXISTS kkcc_institute;
USE kkcc_institute;

CREATE TABLE students (
    student_id INT PRIMARY KEY AUTO_INCREMENT,
    full_name VARCHAR(100) NOT NULL,
    email VARCHAR(100) UNIQUE,
    course VARCHAR(50) DEFAULT 'C Language',
    joined_date DATE
);

-- Insert Records
INSERT INTO students (full_name, email, course, joined_date)
VALUES ('Ramu K.', 'ramu@kkccinfo.com', 'Python', '2026-01-15'),
       ('Meena T.', 'meena@kkccinfo.com', 'Core Java', '2026-02-01');

5. SQL Join Operations (INNER, LEFT JOIN)

SQL Join Query
-- INNER JOIN: Fetch Student details along with Course Fee Info
SELECT s.student_id, s.full_name, c.course_name, c.fee
FROM students s
INNER JOIN courses c ON s.course = c.course_name
WHERE c.fee > 3000
ORDER BY s.full_name ASC;
📝 MySQL Student Practice Queries
  1. Write a SQL query to find top 3 courses with highest student enrollment.
  2. Write a query using GROUP BY and HAVING to calculate total revenue per course.
  3. Write a query to perform a LEFT JOIN between students and project allocations.