0% found this document useful (0 votes)
147 views

MySQL Tutorial

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views

MySQL Tutorial

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

07/06/2024, 17:05 MySQL Tutorial

MySQL Tutorial
AD

MySQL Tutorial
MySQL is the most popular and a free Open Source Relational Database Management
System (RDBMS). An RDBMS system stores the data in the form of tables that might
be related to each other. MySQL uses Structured Query Language (SQL) to store,
manage and retrieve data, and control the accessibility to the data. It is one of the
best RDBMS being used for developing web-based software applications.

MySQL is written in C and C++. Its SQL parser is written in yacc, but it uses a home-
brewed lexical analyzer.

MySQL works on many system platforms, such as, Linux, macOS,


Microsoft Windows, AIX, BSDi, FreeBSD, HP-UX, ArcaOS, eComStation,
IBM i, IRIX, NetBSD, Novell NetWare, OpenBSD, OpenSolaris, OS/2 Warp,
QNX, Oracle Solaris, Symbian, SunOS, SCO OpenServer, SCO UnixWare,
Sanos and Tru64.

This tutorial will give you quick start with MySQL and make you comfortable with
MySQL programming.

AD

MySQL Examples
Consider an example table CUSTOMERS created in the MySQL database. This table
contains the details of customers like ID, NAME, AGE, ADDRESS, SALARY.

ID NAME AGE ADDRESS SALARY

https://www.tutorialspoint.com/mysql/index.htm 1/8
07/06/2024, 17:05 MySQL Tutorial

1 Ramesh 32 Ahmedabad 2000.00

2 Khilan 25 Delhi 1500.00

3 Kaushik 23 Kota 2000.00

4 Chaitali 25 Mumbai 6500.00

5 Hardik 27 Bhopal 8500.00

6 Komal 22 Hyderabad 4500.00

7 Muffy 24 Indore 10000.00

Since MySQL uses SQL to manage data, it also uses almost all DDL, DML and DCL
statements. For instance, the following DML statement lists the records of all
customers who are 25 years old.

SELECT * FROM CUSTOMERS WHERE AGE = 25;

Following records are displayed as a result-set −

ID NAME AGE ADDRESS SALARY

2 Khilan 25 Delhi 1500.00

4 Chaitali 25 Mumbai 6500.00

AD

MySQL Online Editor


In this tutorial, we provide a MySQL Online Editor which helps you to Edit and
Execute the MySQL code directly from your browser. Click on the icon to run the
following MySQL code to be executed on the CUSTOMERS table and retrieve the
records matching with the given condition.

SELECT * FROM CUSTOMERS WHERE NAME = 'Chaitali';

This Online Editor will save you the time to install the MySQL setup in order to
execute any query. Try our MySQL Online Editor now.

https://www.tutorialspoint.com/mysql/index.htm 2/8
07/06/2024, 17:05 MySQL Tutorial
AD

Why to Learn MySQL?


MySQL is generally faster, more secure and efficient than other relational databases.
Some of world's fastest growing organizations make use of MySQL to efficiently
power their high-volume web sites, business-critical systems and packaged software.

However, whether you choose MySQL for your application or not, totally depends on
your organization's resources and aim. Usually, MySQL is used by smaller businesses
that do not have large data sets, because of its cost efficiency and simple setup.

AD

MySQL Jobs and Opportunities


MySQL professionals are in high demand as more and more organizations are using
this open-source database system for efficient data management. If you have the
skills, you could earn an average salary of around $150,000 per year, but it can vary
depending on your location, experience, and job role.

Here are some of the top companies actively looking for MySQL experts for roles like
Database Administrator, Database Developer, Database Tester, Data Scientist, ETL
Developer, Database Migration Expert, Cloud Database Expert, and more. They need
people who can manage and optimize their databases, build data-driven applications,
and extract insights from large datasets −

Google

Amazon

Netflix
Infosys

Tata Consultancy Services (TCS)

Tech Mahindra

Wipro
Pinterest

https://www.tutorialspoint.com/mysql/index.htm 3/8
07/06/2024, 17:05 MySQL Tutorial

Uber

Wipro

Trello
And many more...

To get started, you can use our user-friendly tutorials, which are designed to help
you learn MySQL and prepare for technical interviews or certification exams. You can
learn at your own pace, anytime and anywhere.

With the right MySQL skills and knowledge, you can kickstart a rewarding career in
the ever-expanding field of data management and analytics. You could be the part of
the professionals who are driving innovation and data-driven decision-making in
some of the world's most renowned companies.

AD

Who Should Learn MySQL


This MySQL tutorial has been prepared for beginners to help them understand the
basics to advanced concepts related to MySQL database.

AD

Prerequisites to Learn MySQL


Before you start doing practice with various types of examples given in this
reference, I'm making an assumption that you are already aware about what is
database, especially RDBMS and what is a computer programming language.

Frequently Asked Questions about MySQL


Following are very Frequently Asked Questions(FAQ) about MySQL, and this section
tries to answer them briefly.

What is MySQL and how it works?

https://www.tutorialspoint.com/mysql/index.htm 4/8
07/06/2024, 17:05 MySQL Tutorial

MySQL is a popular open-source relational database management system (RDBMS).


It organizes data into tables with rows and columns. Users can interact with MySQL
using SQL (Structured Query Language) to perform operations like inserting,
updating, and querying data. The system works by processing SQL commands to
manage and retrieve data efficiently.

Who developed MySQL?

MySQL was developed by Swedish company MySQL AB, founded by David Axmark,
Allan Larsson, and Michael "Monty" Widenius. It was later bought by Sun
Microsystems in 2008, which was subsequently acquired by Oracle Corporation in
2010.

How to install MySQL?

You can install MySQL from the MySQL Installer Community, along with other MySQL
products you require. The MySQL Installer will allow you to install a certain version of
MySQL or you can customize the installation as per your requirements. For more
detailed information on how to install MySQL, click here.

What are data types in MySQL

Since MySQL uses SQL to store and manage the data, the data types used in MySQL
are also the same as data types in SQL. Following are three categories of SQL data
types.

String Data types.

Numeric Data types.

Date and time Data types.

How to Learn MySQL?

Here are the summarized list of tips which you can follow to start learning MySQL.

Install MySQL database on your computer system.

Follow our tutorial step by step from the very beginning.

Read more articles, watch online courses or buy a book on MySQL to enhance
your knowledge.

https://www.tutorialspoint.com/mysql/index.htm 5/8
07/06/2024, 17:05 MySQL Tutorial

Try to develop a small software using PHP or Python which makes use of the
MySQL database.

How Long Does It Take to Learn MySQL?

The time it takes to learn MySQL varies, but basic proficiency can be gained in a few
weeks with consistent practice. Mastering more advanced features may take a few
months of dedicated learning and hands-on experience. Regular practice and real-
world application contribute to the speed of learning MySQL.

What is the latest version of MySQL?

The latest version of MySQL was 8.0. Upgrading to the latest version is
recommended for security and feature enhancements.

How to Check the MySQL Version in Linux

To check the MySQL version in Linux, you can use the following command in the
terminal:

mysql --version

This command will display the MySQL client version. If you want to check the server
version, you can use:

mysql -u your_username -p -e "SELECT version();"

Replace "your_username" with your MySQL username, and you will be prompted to
enter your password. After entering the password, the command will display the
MySQL server version.

How do I access my MySQL database?

To access your MySQL database, you can use the MySQL command-line client or a
graphical user interface (GUI) tool. Here are the basic steps for both:
Using MySQL Command-Line Client

https://www.tutorialspoint.com/mysql/index.htm 6/8
07/06/2024, 17:05 MySQL Tutorial

Open terminal/command prompt.


Enter: mysql -u your_username -p.
Enter your password when prompted.

Using GUI Tool (e.g., MySQL Workbench)

Download and install the tool.

Create a new connection with your details.


Test the connection.

Use the GUI to manage your MySQL database.

What are the main features of MySQL?

MySQL is a popular open-source relational database management system (RDBMS)


known for its ease of use and scalability. Its main features include support for SQL
queries, efficient data storage and retrieval, and robust transaction management,
making it suitable for a wide range of applications, from small websites to large
enterprise systems. Additionally, MySQL offers strong security measures and a
vibrant community for support and development.

How to Start, Stop, and Restart MySQL Server

To start, stop, or restart the MySQL server, you can use the command-line interface.
The exact commands may vary depending on your operating system. Here are
instructions for different operating systems:
Windows:

To Start MySQL Server: Open a command prompt with administrator


privileges and run the following command: net start mysql.
To Stop MySQL Server: Open a command prompt with administrator privileges
and run the following command: net stop mysql.

To Restart MySQL Server: You can stop and start the MySQL service using the
commands mentioned above. Alternatively, you can use the MySQL Notifier or
the Services application to restart the MySQL service.

Linux (Ubuntu/Debian):

To Start MySQL Server: sudo service mysql start.

https://www.tutorialspoint.com/mysql/index.htm 7/8
07/06/2024, 17:05 MySQL Tutorial

To Stop MySQL Server: sudo service mysql stop.


To Restart MySQL Server: sudo service mysql restart.

macOS:

To Start MySQL Server: sudo brew services start mysql.

To Stop MySQL Server: sudo brew services stop mysql.


To Restart MySQL Server: sudo brew services restart mysql.

These are general commands, and depending on your specific setup, you might need
to adjust them. Also, note that on Linux, the service management commands may
vary depending on the distribution (e.g., Ubuntu, CentOS).
Remember to replace "mysql" with the actual service name if it's different in your
system.

What is MySQL Schema?

A MySQL schema can simply be defined as a blueprint of the database. It stores all
the information of the tables, its attributes and entities. As MySQL is a relational
database management system, it is important to have schema as it also represents
the relationship between the attributes and entities of multiple tables.

Which is the best place to learn MySQL?

As a beginner, you can use our simple and the best MySQL tutorial to learn MySQL.
We have removed all the unnecessary complexity while teaching you these MySQL
concepts. You can start learning it now: Learn MySQL.

https://www.tutorialspoint.com/mysql/index.htm 8/8

You might also like