Differences Between SQL and MySQL

Habdul Hazeez May 24, 2022
Differences Between SQL and MySQL

This article will teach you five differences between SQL and MySQL.

Differences Between SQL and MySQL

This article will entail both code and explanations, so you have enough to hold onto and clearly understand the differences between SQL and MySQL.

SQL is a Language, Whereas MySQL is a Database Software

SQL stands for Structured Query Language, and it’s a language you can use with a database that supports it. Although MySQL has the word SQL in its name, it is a database software.

If you want to store your data in a database, MySQL is an option for you.

SQL Can Query a Database Whereas MySQL Responds to SQL Queries

SQL is a query language that you can use on a database like MySQL. So, if you have databases in MySQL, you can use SQL to query such data.

To make this clearer, let’s take a look at an example. The following is an SQL code that creates a database in MySQL.

CREATE database DelftStack;

Output:

Query OK, 1 row affected (0.001 sec)

Once the query executes successfully, you can also use SQL to create tables and data in the database. So, the following SQL creates a table in the DelftStack database.

Once we have the table, we can input some data.

CREATE TABLE articles
(article_id INT NOT NULL AUTO_INCREMENT,
article_author VARCHAR(30) NOT NULL,
article_date DATE NOT NULL,
article_title VARCHAR(200) NOT NULL,
article_content LONGTEXT NOT NULL,
PRIMARY KEY (article_id))
ENGINE = InnoDB;

Output:

Query OK, 0 rows affected (0.060 sec)

With the table set up, we can populate it with sample data. So, in the following SQL, we inserted a single record into the articles table.

INSERT INTO articles
(article_id, article_author, article_date, article_title, article_content)
VALUES (NULL, 'Delft Stack', '2022-05-19', 'Decoding charCodeAt() in JavaScript', 'This is a really long post about decoding the charCodeAt() function in JavaScript');

Output:

Query OK, 1 row affected (0.013 sec)

When the database is populated with some data, you can use SQL to query the data. In the following, we use SQL to return all the data in the database table.

SELECT * FROM articles;

Output:

+------------+----------------+--------------+-------------------------------------+-----------------------------------------------------------------------------------+
| article_id | article_author | article_date | article_title                       | article_content                                                                   |
+------------+----------------+--------------+-------------------------------------+-----------------------------------------------------------------------------------+
|          1 | Delf Stack     | 2022-05-19   | Decoding charCodeAt() in JavaScript | This is a really long post about decoding the charCodeAt() function in JavaScript |
+------------+----------------+--------------+-------------------------------------+-----------------------------------------------------------------------------------+
1 row in set (0.093 sec)

SQL Remains Almost the Same Whereas MySQL Gets Updates

SQL follows a standard, so the language remains the same for many years. However, MySQL is a software that gets updated.

These updates could be to fix a bug, a new feature, or a complete rewrite for a new version. For example, the following SQL will work in most databases that support SQL.

Meanwhile, this SQL statement assumes the database has a fruit table.

SELECT * FROM fruit;

Output on MySQL:

+----+-----------+--------+
| id | name      | color  |
+----+-----------+--------+
|  1 | Banana    | Yellow |
|  2 | Pineapple | Green  |
+----+-----------+--------+
2 rows in set (0.037 sec)

The previous SQL code will work on another database that supports SQL. That’s because it’s a SELECT statement that’s been part of SQL for a long time.

Meanwhile, at the time of writing, the current version of MySQL is version 8. Besides, it’s not going to stop there; by the time you read this article, it might be in version nineteen.

SQL is Independent of MySQL While MySQL is Dependent on SQL

SQL can work with databases, e.g., Oracle Database, PostgreSQL, and Microsoft SQL Server. This means SQL is not locked to a specific database.

So you can develop your database to support SQL. However, MySQL is a database, and the only language to work with is SQL.

You Must Learn SQL to Use MySQL Effectively

Deep knowledge of SQL will allow you to make the most of MySQL. Although, tools like phpMyAdmin will enable you to work with MySQL without writing any SQL code.

Still, having a good grip on SQL will allow you to make the most of MySQL. So, to learn SQL, we recommend the following:

  1. Simply SQL by Rudy Limeback
  2. Head First SQL by Lynn Beighley
  3. Learning SQL by Alan Beaulieu
Habdul Hazeez avatar Habdul Hazeez avatar

Habdul Hazeez is a technical writer with amazing research skills. He can connect the dots, and make sense of data that are scattered across different media.

LinkedIn