Practice
Data Structures and Algorithms
Machine Coding Round (LLD)
System Design & Architecture (HLD)
Frontend UI Machine Coding
Resources
Career Advice and Roadmaps
Data Structures and Algorithms
Machine Coding Round (LLD)
System Design & Architecture (HLD)
Backend Development
Frontend Development
Project Ideas for Software Developers
Core Computer Science
Companies
SDE Jobs & Internships
Interview Questions
Compare Companies
IDE
Online IDE
Collaborative IDE

Introduction to MySQL | Features, Data Types & Important Commands

Ujjwal Abhishek
Ujjwal Abhishek

Introduction

MySQL is one of the most popular open-source Relational Database Management Systems (RDBMS).

A MySQL client might hold multiple databases. Each database might contain multiple tables with each table holding data of the same type. Each table contains rows and columns with each row denoting a single entry and each column denoting different attributes of the entries.

Features of MySQL

  • Speed - It is considered one of the fast database languages.
  • Cost - It can be downloaded free of cost from the official website.
  • Easy to use - It is very easy to use.
  • Security - It has a very strong data security layer which makes it secure.
  • Scalability - It works with small and large data, and is very scalable.

Some important MySQL commands

  • CREATE - Create a database or table.
  • DROP - Delete a database or table.
  • ALTER - Modify a database or table.
  • SELECT - Query data.
  • INSERT - Insert data.
  • UPDATE - Update data.
  • DELETE - Delete data.

Data Types in MySQL

MySQL supports a list of predefined data types that we can use to effectively model our tables. These data types are:

  • INT: for integer data.
  • DECIMAL: for decimal data.
  • BOOLEAN: for boolean data.
  • CHAR: for fixed-length string.
  • VARCHAR: for variable-length string.
  • TEXT: for long-form text.
  • DATE: for date data.
  • TIME: for time data.
  • DATETIME: for date-time data.
  • TIMESTAMP: for timestamp data.

Creation of Table

CREATE TABLE  statement is used to create a table in MySQL.

Syntax: CREATE TABLE table_name (column_name column_type);

Deletion of Table

DROP statement is used to delete a table.

Modifying a Table

ALTER statement is used to modify a table.

Querying Data in MySQL

One of the most important functions that a database provides is querying the stored data with or without filters and sorts. We can query data from MySQL using the SELECT clause.

Modifying Data in MySQL

MySQL allows us to insert, update and delete data through INSERT, UPDATE, REPLACE and DELETE clauses.

Grouping Data in MySQL

MySQL allows us to do a grouping of rows to get some aggregated values through the GROUP BY clause. It returns one row per group.

Joining Tables in MySQL

To get data across multiple tables joins are needed. MySQL provides commands for INNER JOIN, LEFT JOIN, RIGHT JOIN, and CROSS JOIN. It does not support FULL OUTER JOIN.
 

1
Ujjwal Abhishek
Ujjwal Abhishek
Ujjwal is final-year CSE Undergraduate, a competitive coder, and a web developer passionate about problem-solving and data structures and algorithms.
SDE Bootcamp - Become a software engineer at a product-based company
Practice Data Structures & Algorithms
Learning Resources
Interview Prep Resources
Blog
  • Career Advice and Roadmaps
  • Data Structures & Algorithms
  • Machine Coding Round (LLD)
  • System Design & Architecture
  • Backend Development
  • Frontend Development
  • Awesome Project Ideas
  • Core Computer Science
Practice Questions
  • Machine Coding (LLD) Questions
  • System Design (HLD) Questions
  • Topic-wise DSA Questions
  • Company-wise DSA Questions
  • DSA Sheets (Curated Lists)
  • JavaScript Interview Questions
  • Frontend UI Machine Coding Questions
Online Compilers (IDE)
  • Online Java Compiler
  • Online C++ Compiler
  • Online C Compiler
  • Online Python Compiler
  • Online JavaScript Compiler
Topic-wise Problems
  • Dynamic Programming Interview Questions
  • Linked List Interview Questions
  • Graph Interview Questions
  • Backtracking Interview Questions
  • Arrays Interview Questions
  • Trees Interview Questions
Company-wise Problems
  • Amazon Interview Questions
  • Microsoft Interview Questions
  • Google Interview Questions
  • Flipkart Interview Questions
  • Adobe Interview Questions
  • Facebook Interview Questions
DSA Sheets (Curated Lists)
  • Top Interview Questions
  • FAANG Interview Questions
  • Most Asked Interview Questions
  • 6 month DSA Practice Sheet
  • 3 month DSA Practice Sheet
  • Last minute DSA Practice Sheet