Close Menu
Waste MindsWaste Minds

    Subscribe to Updates

    Get the latest news from Waste Minds.

    Loading
    What's Hot

    Dark Mode UI: The Future of User Experience

    May 31, 2025

    Theatres vs Streaming: Is the Box Office Making a Comeback?

    April 25, 2025

    Highest Paying Job Oriented Computer Courses

    April 23, 2025
    Facebook Instagram Telegram RSS
    Facebook Instagram Threads X (Twitter) Telegram RSS
    Waste MindsWaste Minds
    Subscribe
    • Home
    • Web, Design & Code
      1. Cheatsheet & Roadmap
      2. Coding
      3. WordPress
      4. Designing
      5. Digital Marketing
      6. View All

      Cheat Your Way to Productivity: Time Management Hacks and Techniques

      July 27, 2023

      What is SQL & SQL Cheatsheet

      June 19, 2022

      Effortless WordPress Migration Guide

      March 18, 2025

      [Fixed] WordPress – Elementor Schemes Manager Error – “Elementor\Core\Schemes\Manager”

      February 1, 2025

      No-Code vs Low-Code: Which Is Best for Modern Websites?

      November 18, 2024

      Add /blog/ to WordPress Blog Permalinks Easily

      October 30, 2024

      Effortless WordPress Migration Guide

      March 18, 2025

      [Fixed] WordPress – Elementor Schemes Manager Error – “Elementor\Core\Schemes\Manager”

      February 1, 2025

      Add /blog/ to WordPress Blog Permalinks Easily

      October 30, 2024

      Optimize WordPress Sub-Menus as 2 Columns Easily using CSS

      October 7, 2024

      Dark Mode UI: The Future of User Experience

      May 31, 2025

      Principles of Design: Understanding the Fundamentals of Visual Design

      March 7, 2023

      Breaking Down the Design Process: From Idea to Execution

      March 1, 2023

      Designing for user experience: Tips and best practices

      February 26, 2023

      Build a Strong Brand Identity for Success

      October 26, 2024

      Digital Marketing in the Metaverse: Key Strategies

      October 9, 2024

      How to Use Schema Markup for Better SEO Results

      September 3, 2024

      Digital Marketing Strategies 2024: Expert Insights and Predictions

      January 18, 2024

      Dark Mode UI: The Future of User Experience

      May 31, 2025

      Boost Your Rankings: Optimize Website Performance for Google

      April 8, 2025

      Effortless WordPress Migration Guide

      March 18, 2025

      [Fixed] WordPress – Elementor Schemes Manager Error – “Elementor\Core\Schemes\Manager”

      February 1, 2025
    • Interview Q&A
      1. Books & Entertainment
      2. Make Money
      3. View All

      Theatres vs Streaming: Is the Box Office Making a Comeback?

      April 25, 2025

      Top Best Books to Master CSS

      May 14, 2022

      Best Websites to Watch Cartoons for Free

      August 27, 2021

      Start Your E-Commerce Store with No Inventory

      March 5, 2025

      AI Tools for Blog Income

      September 7, 2024

      Unlocking Niche E-commerce: Profitable Strategies & Markets

      March 29, 2024

      [Guide] Online Course Success Strategies: Building Your Empire

      January 20, 2024

      Highest Paying Job Oriented Computer Courses

      April 23, 2025

      Nurturing Workplace Mental Health: Strategies and Employee Narratives

      January 22, 2024

      Mastering the Interview Follow-Up: Stand Out After Interview

      August 11, 2023

      Virtual Interviews: Mastering Remote Hiring 2023

      August 7, 2023
    • Lifestyle
    • Others
    • Project Ideas
    • Reviews
    • Tech Updates
      1. Extensions
      2. View All

      Top Chrome extensions for productivity and efficiency – Part 1

      February 26, 2023

      HTTP and HTTPS, TLS Types & SSL Installation Guide

      December 7, 2024

      Top AI Tools: Essential Technologies for Every Industry

      September 9, 2024

      Top AI Tools for Startups to Boost Growth

      September 8, 2024

      Adobe MAX Innovations: Project Stardust, See-Through, Primrose – Part 1

      October 30, 2023
    • Contact
    Waste MindsWaste Minds
    Home » What is SQL & SQL Cheatsheet
    Cheatsheet & Roadmap No Comments

    What is SQL & SQL Cheatsheet

    Vijay KarthikBy Vijay KarthikJune 19, 2022Updated:October 30, 20234 Mins Read66 Views
    Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit VKontakte Telegram WhatsApp Copy Link
    SQL Cheatsheet
    Share
    Email Copy Link Facebook Twitter WhatsApp LinkedIn Telegram Pinterest

    While learning or studying about SQL, it is always hard to remember everything as a human being. So, we have comprised all important commands, keywords, etc to be remembered and in short, we provide SQL Cheatsheet here in this article.

    Contents hide
    1 What is SQL?
    2 What are SQL statements?
    2.1 To be Remembered – SQL Cheatsheet
    2.1.1 Commands for SQL Statements
    2.1.2 Important Keywords
    2.1.3 Database Objects
    2.1.4 Constraints
    2.1.5 Aggregation Functions
    2.1.6 Aggregation Keywords
    2.1.7 Operators
    2.1.8 Joins
    2.1.9 Set Operations
    3 SQL Query Examples:
    3.1 DDL Examples:
    3.1.1 Create a Table:
    3.1.2 Adding a new column to the Table:
    3.1.3 Modifying the data type of existing column:
    3.1.4 Removing a existing column from the Table:
    3.1.5 Truncate (remove all data) a Table:
    3.1.6 Drop a Table:
    3.2 DQL Examples:
    3.2.1 Fetch all data from a Table:
    3.2.2 Fetch count of records:
    3.2.3 Filter data from a Table:
    3.2.4 Fetch selected columns:
    3.2.5 Fetch maximum 10 rows:
    3.2.6 Fetch Maximum Age:
    3.2.7 Fetch Minimum Age:
    3.2.8 Fetch Sum of Age:
    3.2.9 Fetch Average Age:
    3.2.10 Fetch Average Age for each Gender:
    3.2.11 Sort (Order) Fetched Records:
    3.2.12 Sort in Descending Order:
    3.2.13 Fetch from 2 Tables:
    3.2.14 Aggregate and Filter:
    3.2.15 Full Outer Join:
    3.3 DML Examples:
    3.3.1 Insert data (rows) into a Table:
    3.3.2 Update data (value of Column) of a Table:
    3.3.3 Delete data (rows) from a Table:

    What is SQL?

    SQL stands for Structured Query Language. SQL is a database computer language designed for storing, manipulating and retrieving data in databases.

    Database SQL

    What are SQL statements?

    A statement is any text that the database engine recognizes as a valid command. There are 5 types of SQL Statements and they are:

    1. DDL – Data Definition Language
    2. DQL – Data Query Language
    3. DML – Data Manipulation Language
    4. DCL – Data Control Language
    5. TCL – Transaction Control Language

    To be Remembered – SQL Cheatsheet

    • Commands for SQL Statements

      • DDL – CREATE | DROP | ALTER | TRUNCATE | RENAME | COMMENT
      • DQL – SELECT
      • DML – INSERT | UPDATE | DELETE | LOCK CALL | EXPLAIN PLAN
      • DCL – GRANT | REVOKE
      • TCL – COMMIT | ROLLBACK | SAVEPOINT | SET TRANSACTION
    • Important Keywords

      • WHERE | DISTINCT | LIMIT | ORDER BY | DESC | ASC | AS
    • Database Objects

      • TABLE | VIEW | SYNONYM | SEQUENCE | INDEX | TRIGGER
    • Constraints

      • NOT NULL | UNIQUE | PRIMARY KEY | FOREIGN KEY | CHECK | DEFAULT
    • Aggregation Functions

      • AVG | COUNT | MAX | MIN | SUM
    • Aggregation Keywords

      • GROUP BY | HAVING
    • Operators

      • Arithmetic+   –   *   /   %
        Bitwise&   ^   |
        Comparison=   <   >   <=   >=   !<   !>   <>   !=
        Compound+=   -=   *=   /=   %=   &=   !=    ^=
        LogicalAND | OR | NOT | ANY | SOME | ALL | BETWEEN | IN | EXISTS | LIKE | IS NULL | UNIQUE
    • Joins

      • Inner Join

        Inner Join

        Left [Outer] Join

        Left Join

        Right [Outer] Join

        Right Join

        Full Outer Join

        Full Outer Join

    • Set Operations

      • UNION | UNION ALL

        Union or Union All

        INTERSECT

        Intersect

        EXCEPT | MINUS

        Except-Minus

    SQL Query Examples:

    DDL Examples:

    Create a Table:

    CREATE TABLE Students (
        rollno int PRIMARY KEY, 
        fname varchar(255) NOT NULL, 
        lname varchar(255)
    );

    Adding a new column to the Table:

    ALTER TABLE Students 
    ADD email varchar(255);

    Modifying the data type of existing column:

    ALTER TABLE Students
    ALTER COLUMN lname varchar(512);

    Removing a existing column from the Table:

    ALTER TABLE Students 
    DROP COLUMN email

    Truncate (remove all data) a Table:

    TRUNCATE TABLE Students;

    Drop a Table:

    DROP TABLE Students;

    DQL Examples:

    Fetch all data from a Table:

    SELECT * FROM Students;

    Fetch count of records:

    SELECT count(*) FROM Students;

    Filter data from a Table:

    SELECT * FROM Students 
    WHERE rollno=1234;
    
    SELECT * FROM Students 
    WHERE rollno>1234 
    AND   age < 15;

    Fetch selected columns:

    SELECT fname,lname
    FROM Students
    WHERE rollno>1234
    AND age < 15;

    Fetch maximum 10 rows:

    SELECT fname,lname
    FROM Students
    WHERE rollno>1234
    AND age < 15
    LIMIT 10;

    Fetch Maximum Age:

    SELECT max(age)
    FROM Students;

    Fetch Minimum Age:

    SELECT min(age)
    FROM Students;

    Fetch Sum of Age:

    SELECT sum(age)
    FROM Students;

    Fetch Average Age:

    SELECT avg(age)
    FROM Students;

    Fetch Average Age for each Gender:

    SELECT avg(age)
    FROM Students
    GROUP BY gender;

    Sort (Order) Fetched Records:

    SELECT fname,lname
    FROM Students
    WHERE rollno>1234
    AND age < 15
    ORDER BY gender;

    Sort in Descending Order:

    SELECT fname,lname
    FROM Students
    WHERE rollno>1234
    AND age < 15
    ORDER BY gender DESC;

    Fetch from 2 Tables:

    SELECT fname,classteacher
    FROM Students
    INNER JOIN Section
    ON Students.section=Section.id;

    Aggregate and Filter:

    SELECT section,count(*) AS studentcount
    FROM Students
    GROUP BY section
    HAVING count(*) > 20;

    Full Outer Join:

    SELECT fname,classteacher
    FROM Students
    FULL JOIN Section
    ON Students.section=Section.id;

    DML Examples:

    Insert data (rows) into a Table:

    INSERT INTO Students (rollno, fname, lname)
    VALUES (12345,'Saranya','Karthik');

    Update data (value of Column) of a Table:

    UPDATE Students SET lname='Kumar'
    WHERE rollno=12346;

    Delete data (rows) from a Table:

    DELETE FROM Students WHERE rollno=1234

    For more detailed Tutorial, Please refer

    • SQL Tutorial (w3schools.com)
    • SQL Tutorial (tutorialspoint.com)
    • Learn SQL Tutorial – javatpoint
    Aggregation Functions in SQL Aggregation Keywords in SQL Commands for SQL Statements Constraints in SQL Data Definition Language Data Manipulation Language Data Query Language Database Objects DCL DCL - Data Control Language DDL DDL - Data Definition Language DML DML - Data Manipulation Language DQL DQL - Data Query Language Important Keywords in SQL Joins Joins in SQL Operators in SQL Set Operations in SQL SQL SQL (Structured Query Language) SQL Aggregation Functions SQL Aggregation Keywords SQL Contraints SQL Examples SQL Joins SQL Operators SQL Set Operations SQL Statement Examples SQL Statements Structured Query Language TCL TCL - Transaction Control Language Transaction Control Language What is SQL? What is Structured Query Language
    Share. Email Copy Link Facebook Twitter WhatsApp Telegram Pinterest LinkedIn Tumblr Reddit
    Avatar of Vijay Karthik
    Vijay Karthik
    • Website
    • Facebook
    • X (Twitter)
    • Instagram

    Entrepreneur & CEO | Crafting Digital Experiences | Code Magician (Web Dev) | Online Marketing Maven | Business & Project Analyst.

    Related Posts

    Cheatsheet & Roadmap 4 Mins Read21 Views

    Cheat Your Way to Productivity: Time Management Hacks and Techniques

    By Vijay KarthikJuly 27, 2023Updated:October 30, 2023
    Leave A Reply Cancel Reply

    Search
    Follow Us on Social
    • Facebook
    • Instagram
    • Threads
    • Twitter
    • Telegram

    Subscribe to Updates

    Get the latest news from Waste Minds.

    Loading
    Editors Picks

    Steps to enable VoLTE on Vi™

    October 26, 2020

    Urban Gardening: Lush Green Spaces in Small Areas

    November 1, 2024

    Start Your E-Commerce Store with No Inventory

    March 5, 2025

    Things to be Stopped for a Better Life

    June 17, 2022
    8.5

    Hostripples India Review

    March 27, 2022
    Top Reviews
    93
    Reviews

    WP Engine Review

    By Vijay Karthik
    93
    Reviews

    WP Rocket – WordPress Cache Plugin Review

    By Vijay Karthik
    90
    Reviews

    Elementor Review: Unleashing the Power of Visual Website Building

    By Vijay Karthik
    Categories
    • Books & Entertainment (3)
    • Interview Q&A (7)
    • Lifestyle (24)
    • Make Money (10)
    • Others (2)
    • Project Ideas (6)
    • Reviews (11)
    • Tech Updates (20)
      • Extensions (1)
    • Web, Design & Code (43)
      • Cheatsheet & Roadmap (2)
      • Coding (18)
        • Wordpress (13)
      • Designing (4)
      • Digital Marketing (16)
    Archives
    • May 2025 (1)
    • April 2025 (3)
    • March 2025 (2)
    • February 2025 (3)
    • December 2024 (2)
    • November 2024 (3)
    • October 2024 (8)
    • September 2024 (5)
    • August 2024 (1)
    • July 2024 (3)
    • June 2024 (1)
    • March 2024 (1)
    • January 2024 (4)
    • December 2023 (2)
    • November 2023 (3)
    • October 2023 (3)
    • August 2023 (12)
    • July 2023 (16)
    • March 2023 (3)
    • February 2023 (9)
    • January 2023 (1)
    • November 2022 (1)
    • October 2022 (1)
    • July 2022 (1)
    • June 2022 (6)
    • May 2022 (6)
    • April 2022 (2)
    • March 2022 (4)
    • October 2021 (3)
    • September 2021 (1)
    • August 2021 (1)
    • July 2021 (4)
    • March 2021 (1)
    • December 2020 (1)
    • November 2020 (1)
    • October 2020 (1)
    Advertisement
    Top Reviews
    8.2

    Screpy SEO Tool Review

    November 23, 2023
    8.6

    Reseller Club Hosting Review

    August 12, 2023
    9.3

    WP Engine Review

    August 4, 2023
    9.0

    Elementor Review: Unleashing the Power of Visual Website Building

    July 23, 2023
    8.8

    Contabo Hosting Review

    March 3, 2023
    Latest Post

    Dark Mode UI: The Future of User Experience

    May 31, 2025

    Theatres vs Streaming: Is the Box Office Making a Comeback?

    April 25, 2025

    Highest Paying Job Oriented Computer Courses

    April 23, 2025

    Boost Your Rankings: Optimize Website Performance for Google

    April 8, 2025

    Effortless WordPress Migration Guide

    March 18, 2025

    Subscribe to Updates

    Get the latest news from Waste Minds.

    Loading
    Waste Minds
    Facebook Instagram Threads X (Twitter) Telegram RSS
    • Privacy Policy
    • Terms and Conditions
    Copyright © 2021-2025 - Waste Minds. All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.