SlideShare a Scribd company logo
A QUALITY PARTNER FOR YOUR GROWTH
MySql Overview
• In this presentation you will learn about-
• Introduction & features of MySQL
• Types of SQL Commands- DDL, DML, TCL & DCL
• Data types in MySQL
• Creating Database & Tables
• Inserting, Deleting and modifying records
• Making Simple Queries
• Altering Table Structure
Objective
• MySQL is an Open Source, Fast and Reliable Relational Database Management
System (RDBMS) software like Oracle, Sybase, MS SQL Server etc. It was developed
by Michael Widenius and AKA Monty.
• The main features of MySQL are-
 Open Source & Free of Cost:
• It is Open Source and available at free of cost.
 Portability:
• It can be installed and run on any types of Hardware and OS like Linux, MS
Windows or Mac etc.
 Security :
• It creates secured database protected with password.
 Connectivity
• It may connect various types of Network client using different protocols and
Programming Languages .
 Query Language
• It uses SQL (Structured Query Language) for handling database.
Introduction to MySQL
• In order to access data from the MySQL database, all program and user must
use SQL (Structured Query Language). SQL is a set of commands that are
recognized by all the RDBMSs and has become a standard language for
database handling.
• SQL is a language that enables you to create and manage a relational database, in
which all the information are kept in tables.
• There are numerous version of SQL. The original version was developed at IBM’s
San Jose Research Laboratory with a name of Sequel, as a part of System R project
in 1970s. It was standardized by ANSI in 1986 by the name of SQL.
MySQL & SQL
• MySQL follows SQL specifications for its commands . These SQL commands can be
categorized as -
 Data Definition Language (DDL)
• These SQL commands are used to create, alter and delete database objects like
table, views, index etc.
• Example : CREATE , ALTER , DROP etc.
 Data Manipulation Language (DML)
• These commands are used to insert, delete, update and retrieve the stored records from
the table.
• Ex. SELECT…., INSERT…, DELETE…, UPDATE…. etc.
 Transaction Control Language (TCL)
• These commands are used to control the transaction. Ex. COMMIT,
ROLLBACK, SAVEPOINT etc.
 Data Control Language (DCL)
• These commands are used to manipulate permissions or access rights to the tables etc.
• Ex. GRANT , REVOKE etc.
Types of SQL Commands
 Numeric Data Types:
 INTEGER or INT – up to 11 digit number without decimal.
 SMALLINT – up to 5 digit number without decimal.
 FLOAT (M,D) or DECIMAL(M,D) or NUMERIC(M,D)
• Stores Real numbers upto M digit length (including .) with D
• decimal places.
• e.g. Float (10,2) can store 1234567.89
 Date & Time Data Types:
 DATE - Stores date in YYYY-MM-DD format.
 TIME - Stores time in HH:MM:SS format.
 String or Text Data Type:
 CHAR(Size)
• A fixed length string up to 255 characters. (default is 1)
 VARCHAR(Size)
• A variable length string up to 255 characters.
Data type in MySQL
 Creating a Database.
• The following command will create School database in MySQL.
• mysql> CREATE DATABASE School;
 Opening a database
• To open an existing database, following command is used.
• mysql> USE school ;
 Getting listings of database and tables
• mysql> SHOW DATABASES;
• mysql> SHOW TABLES;
 Deleting a Database and Table
mysql> DROP DATABASE School;
DROP TABLE Student;
 Viewing Table Structure
mysql> DESCRIBE Student;
Database Handling commands in MySQL
 Creating Simple Tables:
• CREATE TABLE < Table Name>
• (<Col name1><data type>[(size)],….);
• Data types- INTEGER, NUMERIC(P,D), CHAR(n), VARCHAR(n), DATE etc.
mysql> CREATE TABLE Employee
(empID Integer,
ename char(30),
city char(25),
pay decimal(10,2));
 Inserting Records:
• INSERT INTO <Table Name> VALUES (value1, vale2, …...); String and Date type
values must be enclosed in single or double quotes.
• mysql> INSERT INTO Employee VALUES (1,‘Amitabh’,‘Allahabad’,15000);
• mysql> INSERT INTO Employee VALUES (2, ‘Akbar’, ‘Dehradun’,20000);
Creating Tables & Inserting records
• The SELECT command of SQL, empower you to make a request (queries) to
retrieve stored records from the database.
• The syntax of SQL is given below-
SELECT < [Distinct | ALL] *| column name(s)> FROM <table(s)>
WHERE <condition>
ORDER BY <column name> [ASC | DESC] ;
• Consider the table Student having some records as –
Making Simple Queries Using SELECT
• Selecting all columns
• If you want to view all columns of the student table, then you should give the
following command-
• mysql> SELECT * FROM Student ;
• MySQL will display the all records with all columns in the Student table.
• Is used to represent all columns.
• Selecting columns
• If you want to view only Name and City columns of the student table
• mysql> SELECT Name, City FROM Student ;
• Eliminating Duplicate values in a column - DISTINCT
• mysql> SELECT City FROM Student ;
Mumbai is repeated
Mumbai is repeated
Only Unique Cities are displayed
 Doing simple calculations
• We can also perform simple calculations with SQL Select command. SQL provide a dummy
table named DUAL, which can be used for this purpose.
• mysql> SELECT 4*3 ;
• We can also extend this idea with a columns of the existing table.
SELECT Name, Sal *12 FROM EMP ;
 Using Column Aliases
• We can give a different name to a column or expression (Alias) in the
mysql> SELECT Name, Sal*12 AS ‘Annual Salary’ FROM EMP;
mysql> SELECT Name, DOB AS ‘Date of Birth’ FROM Student;
mysql> SELECT 22/7 AS PI FROM Dual;
When Alias name is a single word then single quotes is
not required.
Alias for Sal*12
Where Condition
• WHERE <Condition>
•We can select specific records by specifying conditions with WHERE clause.
• mysql> SELECT * FROM Student WHERE City=‘Mumbai’;
Selecting Specific Records – WHERE clause
Selecting Specific Rows – WHERE clause
Selecting Specific Rows – WHERE clause
mysql> SELECT Name, Basic+DA AS ‘PAY’ FROM Student ORDER BY
PAY;
Inserting Records in a Table
• You can insert record in the table by using by using the following DML command.
• INSERT INTO<Table Name> [<Column list>] VALUES<list of
values>
• If value is not available for a column, NULL can be used.
• Suppose a table STUDENT has been created as per given structure-
StID NAME FNAME DOB CITY CLASS
mysql> INSERT INTO Student (StID, FName, Name, Class)
VALUES (‘s3’,’Amitabh’, ’Abhishek’, 10);
Inserting Records from Other Table
• You can insert all or selected record(s) in the table from another table by using
Select … command in place of Values.
• Suppose a table named NEWSTUDENT has been created and records to be inserted
from OLDSTUDENT table having the same structure of columns.
WHERE Class>=11);
Deleting Records from the Table
• You can delete all or selected record(s) from the table by using the following DML command.
• DELETE FROM<Table Name> [WHERE <Condition>]
Modifying Records –UPDATE Command
•You can modify the values of columns of all or selected records in the table by using
the following DML command.
• UPDATE <Table Name>
• SET <Column> = <Expression> [WHERE
<Condition>]
• mysql> UPDATE Student SET Class =10;
Working with Tables
Creating Table with Constraints
• One of the major responsibility of a DBMS is to maintain the Integrity of the data i.e.
Data being stored in the Database must be correct and valid.
• An Integrity Constraints are condition or checks applicable to a column or table which
ensures the integrity and validity of data.
• The following constraints are available in MySQL.
Implementing Constraints in the Table
• Defining Primary Key at Column Level:
Implementing Primary Key Constraints
mysql> CREATE TABLE Student
• Defining Primary Key at Table Level:
Handling Tables
Modifying Table Structure
Modifying Table Structure
THANKYOU
THANKS FOR WATCHING THIS PRESENTATION
Information Technologies Solutions & Services
ADDRESS : 109, CHEMIN DU PONT DU CENTENAIRE, PLAN-LES-OUATES GENEVA 1228 SWITZERLAND.
EMAIL: INFO@ITSSGLOBAL.COM, URL: WWW.ITSSGLOBAL.COM

More Related Content

PPT
Sql Commands_Dr.R.Shalini.ppt
PPT
Php Presentation
PPTX
PostgreSQL Database Slides
PPTX
Angularjs PPT
PPTX
SQLite - Overview
PPTX
Network and System Administration Power Point
PPT
Java Servlets
PDF
PostgreSQL Tutorial For Beginners | Edureka
Sql Commands_Dr.R.Shalini.ppt
Php Presentation
PostgreSQL Database Slides
Angularjs PPT
SQLite - Overview
Network and System Administration Power Point
Java Servlets
PostgreSQL Tutorial For Beginners | Edureka

What's hot (20)

PPT
Introduction to sql
PPTX
Lab2 ddl commands
PPTX
Introduction to Oracle Database
PDF
Django Introduction & Tutorial
PPTX
Introduction to PHP
PPTX
Servlets
PPTX
Java DataBase Connectivity API (JDBC API)
PPTX
SQL Basics
PPTX
Sql - Structured Query Language
PDF
Java Course 8: I/O, Files and Streams
PPTX
Sqlite
PPTX
Spring Boot and REST API
PDF
Introduction to gradle
PPT
Jdbc ppt
PDF
Spring boot
PPT
Domain name service
PPT
DOT Net overview
PPTX
Sql queries presentation
DOC
Creating a Simple PHP and MySQL-Based Login System
Introduction to sql
Lab2 ddl commands
Introduction to Oracle Database
Django Introduction & Tutorial
Introduction to PHP
Servlets
Java DataBase Connectivity API (JDBC API)
SQL Basics
Sql - Structured Query Language
Java Course 8: I/O, Files and Streams
Sqlite
Spring Boot and REST API
Introduction to gradle
Jdbc ppt
Spring boot
Domain name service
DOT Net overview
Sql queries presentation
Creating a Simple PHP and MySQL-Based Login System
Ad

Similar to Mysql-overview.pptx (20)

PPTX
Data Base Management 1 Database Management.pptx
PDF
Introduction to MySQL and introduction to basic queries
PPTX
sql.pptx
PPTX
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
PPTX
PPTX
sql12.pptxsql12.pptxsql12.pptxsql12.pptx
PDF
Sql12
PPTX
Unit - II.pptx
PPTX
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
PPTX
unit-ii.pptx
PPTX
Getting Started with MySQL I
PPTX
SQL.pptx for the begineers and good know
PPTX
Using Basic Structured Query Language lo1.pptx
PDF
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
PDF
SQL_NOTES.pdf
PPT
MySQL and its basic commands
PDF
Chapter – 6 SQL Lab Tutorial.pdf
PPTX
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
PDF
sql_data.pdf
PDF
Php, mysq lpart5(mysql)
Data Base Management 1 Database Management.pptx
Introduction to MySQL and introduction to basic queries
sql.pptx
hjkjlboiupoiuuouoiuoiuoiuoiuoiuoippt.pptx
sql12.pptxsql12.pptxsql12.pptxsql12.pptx
Sql12
Unit - II.pptx
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
unit-ii.pptx
Getting Started with MySQL I
SQL.pptx for the begineers and good know
Using Basic Structured Query Language lo1.pptx
mysqlanditsbasiccommands-150226033905-conversion-gate02.pdf
SQL_NOTES.pdf
MySQL and its basic commands
Chapter – 6 SQL Lab Tutorial.pdf
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
sql_data.pdf
Php, mysq lpart5(mysql)
Ad

Recently uploaded (20)

PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PDF
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
PPTX
vedic maths in python:unleasing ancient wisdom with modern code
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
PPTX
An introduction to Prepositions for beginners.pptx
PDF
Landforms and landscapes data surprise preview
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
PDF
Sunset Boulevard Student Revision Booklet
PPTX
Skill Development Program For Physiotherapy Students by SRY.pptx
PDF
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PDF
What Is Coercive Control? Understanding and Recognizing Hidden Abuse
PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
PDF
Types of Literary Text: Poetry and Prose
PPTX
Software Engineering BSC DS UNIT 1 .pptx
PPTX
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
PDF
5.Universal-Franchise-and-Indias-Electoral-System.pdfppt/pdf/8th class social...
PDF
LDMMIA Reiki Yoga Workshop 15 MidTerm Review
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
vedic maths in python:unleasing ancient wisdom with modern code
Information Texts_Infographic on Forgetting Curve.pptx
An introduction to Prepositions for beginners.pptx
Landforms and landscapes data surprise preview
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Sunset Boulevard Student Revision Booklet
Skill Development Program For Physiotherapy Students by SRY.pptx
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
Module 3: Health Systems Tutorial Slides S2 2025
What Is Coercive Control? Understanding and Recognizing Hidden Abuse
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Types of Literary Text: Poetry and Prose
Software Engineering BSC DS UNIT 1 .pptx
HISTORY COLLECTION FOR PSYCHIATRIC PATIENTS.pptx
5.Universal-Franchise-and-Indias-Electoral-System.pdfppt/pdf/8th class social...
LDMMIA Reiki Yoga Workshop 15 MidTerm Review

Mysql-overview.pptx

  • 1. A QUALITY PARTNER FOR YOUR GROWTH MySql Overview
  • 2. • In this presentation you will learn about- • Introduction & features of MySQL • Types of SQL Commands- DDL, DML, TCL & DCL • Data types in MySQL • Creating Database & Tables • Inserting, Deleting and modifying records • Making Simple Queries • Altering Table Structure Objective
  • 3. • MySQL is an Open Source, Fast and Reliable Relational Database Management System (RDBMS) software like Oracle, Sybase, MS SQL Server etc. It was developed by Michael Widenius and AKA Monty. • The main features of MySQL are-  Open Source & Free of Cost: • It is Open Source and available at free of cost.  Portability: • It can be installed and run on any types of Hardware and OS like Linux, MS Windows or Mac etc.  Security : • It creates secured database protected with password.  Connectivity • It may connect various types of Network client using different protocols and Programming Languages .  Query Language • It uses SQL (Structured Query Language) for handling database. Introduction to MySQL
  • 4. • In order to access data from the MySQL database, all program and user must use SQL (Structured Query Language). SQL is a set of commands that are recognized by all the RDBMSs and has become a standard language for database handling. • SQL is a language that enables you to create and manage a relational database, in which all the information are kept in tables. • There are numerous version of SQL. The original version was developed at IBM’s San Jose Research Laboratory with a name of Sequel, as a part of System R project in 1970s. It was standardized by ANSI in 1986 by the name of SQL. MySQL & SQL
  • 5. • MySQL follows SQL specifications for its commands . These SQL commands can be categorized as -  Data Definition Language (DDL) • These SQL commands are used to create, alter and delete database objects like table, views, index etc. • Example : CREATE , ALTER , DROP etc.  Data Manipulation Language (DML) • These commands are used to insert, delete, update and retrieve the stored records from the table. • Ex. SELECT…., INSERT…, DELETE…, UPDATE…. etc.  Transaction Control Language (TCL) • These commands are used to control the transaction. Ex. COMMIT, ROLLBACK, SAVEPOINT etc.  Data Control Language (DCL) • These commands are used to manipulate permissions or access rights to the tables etc. • Ex. GRANT , REVOKE etc. Types of SQL Commands
  • 6.  Numeric Data Types:  INTEGER or INT – up to 11 digit number without decimal.  SMALLINT – up to 5 digit number without decimal.  FLOAT (M,D) or DECIMAL(M,D) or NUMERIC(M,D) • Stores Real numbers upto M digit length (including .) with D • decimal places. • e.g. Float (10,2) can store 1234567.89  Date & Time Data Types:  DATE - Stores date in YYYY-MM-DD format.  TIME - Stores time in HH:MM:SS format.  String or Text Data Type:  CHAR(Size) • A fixed length string up to 255 characters. (default is 1)  VARCHAR(Size) • A variable length string up to 255 characters. Data type in MySQL
  • 7.  Creating a Database. • The following command will create School database in MySQL. • mysql> CREATE DATABASE School;  Opening a database • To open an existing database, following command is used. • mysql> USE school ;  Getting listings of database and tables • mysql> SHOW DATABASES; • mysql> SHOW TABLES;  Deleting a Database and Table mysql> DROP DATABASE School; DROP TABLE Student;  Viewing Table Structure mysql> DESCRIBE Student; Database Handling commands in MySQL
  • 8.  Creating Simple Tables: • CREATE TABLE < Table Name> • (<Col name1><data type>[(size)],….); • Data types- INTEGER, NUMERIC(P,D), CHAR(n), VARCHAR(n), DATE etc. mysql> CREATE TABLE Employee (empID Integer, ename char(30), city char(25), pay decimal(10,2));  Inserting Records: • INSERT INTO <Table Name> VALUES (value1, vale2, …...); String and Date type values must be enclosed in single or double quotes. • mysql> INSERT INTO Employee VALUES (1,‘Amitabh’,‘Allahabad’,15000); • mysql> INSERT INTO Employee VALUES (2, ‘Akbar’, ‘Dehradun’,20000); Creating Tables & Inserting records
  • 9. • The SELECT command of SQL, empower you to make a request (queries) to retrieve stored records from the database. • The syntax of SQL is given below- SELECT < [Distinct | ALL] *| column name(s)> FROM <table(s)> WHERE <condition> ORDER BY <column name> [ASC | DESC] ; • Consider the table Student having some records as – Making Simple Queries Using SELECT
  • 10. • Selecting all columns • If you want to view all columns of the student table, then you should give the following command- • mysql> SELECT * FROM Student ; • MySQL will display the all records with all columns in the Student table. • Is used to represent all columns.
  • 11. • Selecting columns • If you want to view only Name and City columns of the student table • mysql> SELECT Name, City FROM Student ;
  • 12. • Eliminating Duplicate values in a column - DISTINCT • mysql> SELECT City FROM Student ; Mumbai is repeated Mumbai is repeated Only Unique Cities are displayed
  • 13.  Doing simple calculations • We can also perform simple calculations with SQL Select command. SQL provide a dummy table named DUAL, which can be used for this purpose. • mysql> SELECT 4*3 ; • We can also extend this idea with a columns of the existing table. SELECT Name, Sal *12 FROM EMP ;  Using Column Aliases • We can give a different name to a column or expression (Alias) in the mysql> SELECT Name, Sal*12 AS ‘Annual Salary’ FROM EMP; mysql> SELECT Name, DOB AS ‘Date of Birth’ FROM Student; mysql> SELECT 22/7 AS PI FROM Dual; When Alias name is a single word then single quotes is not required. Alias for Sal*12
  • 14. Where Condition • WHERE <Condition> •We can select specific records by specifying conditions with WHERE clause. • mysql> SELECT * FROM Student WHERE City=‘Mumbai’;
  • 15. Selecting Specific Records – WHERE clause
  • 16. Selecting Specific Rows – WHERE clause
  • 17. Selecting Specific Rows – WHERE clause mysql> SELECT Name, Basic+DA AS ‘PAY’ FROM Student ORDER BY PAY;
  • 18. Inserting Records in a Table • You can insert record in the table by using by using the following DML command. • INSERT INTO<Table Name> [<Column list>] VALUES<list of values> • If value is not available for a column, NULL can be used. • Suppose a table STUDENT has been created as per given structure- StID NAME FNAME DOB CITY CLASS mysql> INSERT INTO Student (StID, FName, Name, Class) VALUES (‘s3’,’Amitabh’, ’Abhishek’, 10);
  • 19. Inserting Records from Other Table • You can insert all or selected record(s) in the table from another table by using Select … command in place of Values. • Suppose a table named NEWSTUDENT has been created and records to be inserted from OLDSTUDENT table having the same structure of columns. WHERE Class>=11);
  • 20. Deleting Records from the Table • You can delete all or selected record(s) from the table by using the following DML command. • DELETE FROM<Table Name> [WHERE <Condition>]
  • 21. Modifying Records –UPDATE Command •You can modify the values of columns of all or selected records in the table by using the following DML command. • UPDATE <Table Name> • SET <Column> = <Expression> [WHERE <Condition>] • mysql> UPDATE Student SET Class =10;
  • 23. Creating Table with Constraints • One of the major responsibility of a DBMS is to maintain the Integrity of the data i.e. Data being stored in the Database must be correct and valid. • An Integrity Constraints are condition or checks applicable to a column or table which ensures the integrity and validity of data. • The following constraints are available in MySQL.
  • 25. • Defining Primary Key at Column Level: Implementing Primary Key Constraints mysql> CREATE TABLE Student • Defining Primary Key at Table Level:
  • 29. THANKYOU THANKS FOR WATCHING THIS PRESENTATION Information Technologies Solutions & Services ADDRESS : 109, CHEMIN DU PONT DU CENTENAIRE, PLAN-LES-OUATES GENEVA 1228 SWITZERLAND. EMAIL: [email protected], URL: WWW.ITSSGLOBAL.COM