What’s the difference between SQL and MySQL?

Learn the difference between these two popular technologies and the way they are talked about in industry…

What’s the difference between SQL and MySQL?
Image by mcmurryjulie from Pixabay

Before we dive in, let us define some key terms that are typically used interchangeably, but are important to distinguish in the coming discussion.

Key Terms

Database — an organized collection of logically related data arranged for ease and speed of retrieval [1][2].

Database management system (DBMS) — “a software system that is used to create, maintain, and provide controlled access to user databases” [1].

Story time

In 1970, a computer scientist named E. F. Codd blessed the world with the relational model, an idea rooted in the mathematics of relational algebra that gave us the now popular view of data organized as tables in DBMSes [3]. Four years later in 1974, Chamberlin and Boyce, Codd’s colleagues at IBM, proposed a structured query language based on the relational model they called SEQUEL [4].

SEQUEL was later renamed SQL because of a trademark conflict [5].

In the time following the publication of the relational model and SEQUEL papers, IBM competed with Oracle, then named Relational Software, Inc., to bring the first commercial implementation of SQL to market. Oracle won in 1979 with their SQL-based relational DBMS Oracle V2 [6][7].

Before the end of the next decade, the American National Standards Institute (ANSI) and the International Standards Organization (ISO) agreed to make SQL the standard language for managing relational databases in 1986 and 1987 respectively [1]. As database management needs changed over the years, the SQL standard has been updated to accommodate those needs.

Prior to the development of the relational model and SQL, managing databases was tedious. Developers had to organize and manipulate flat files — an approach to database management called file processing. Other models also suffered from a slew of problems that made database management more challenging [1].

Today, the relational model is the most widely adopted. It allows the flexibility developers need to organize and manage data, and SQL provides a declarative language to do so. Since this approach gained in popularity, most developers no longer need to write code to organize and manipulate files. High maintenance burdens associated with previous database management approaches were also eased.

What is SQL?

SQL is a declarative, structured query language for managing databases through DBMSes that implement the relational model. This is historically accurate, but SQL’s unquestionable success has caused some DBMS and query language developers to implement SQL as the query language for modern non-relational databases. One example of such a decision is Amazon Redshift [8][9].

SQL may also refer to the ANSI/ISO standards that specify the features and behaviors of a SQL language. Typically, when discussing SQL standards, the year the standard was published is indicated. For example, the standards were initially referred to as SQL-86, SQL-89, and SQL-92, but later took the form SQL:1999, SQL:2003, and SQL:2006.

What is MySQL?

So far, we’ve discussed SQL as a language and a standard.

Languages that implement the SQL standard are often called flavors, variants, or dialects of SQL, and we say these languages are compliant with whatever version of the SQL standard they implement.

MySQL is a DBMS that allows us to develop and manage databases using its own flavor of SQL.

SQL flavors are different from standard SQL in that they implement extensions — that is, additional language features that go beyond those specified in the SQL standards. Furthermore, these flavors differ among themselves by the extensions they implement, how the extensions behave, and minor differences in syntax, among other differences.

SQL is supposed to be standard, so why do all these different SQL flavors exist?

This is a fair question. One reason is that the developers of these DBMSes and SQL flavors found the SQL standard lacking in specifications for functionalities they deem important to their customers. This leads them to implement extensions that meet their customers’ needs.

Minor differences in syntax may also stem from the aesthetics of the original language and DBMS developers which are maintained for backwards compatibility and ease of migration to future versions of their systems.

Yet another reason for some differences is that the developers may make design decisions to fulfill non-functional requirements, such as performance and convenience, that lead them to implement things a bit differently.

The SQL standards ensure there is a consistent set of features that function in a particular manner. This makes it so that we don’t have to learn and use an entirely new language simply because we’re using a different DBMS.

You can use other relational DBMSes knowing that SELECT, FROM, WHERE, GROUP BY, HAVING, and ORDER BY, for example, are all available to you and behave consistently.

Conclusion

SQL may refer to the structured query language used to manage relational databases. It can also refer to the standards that specify the features and behaviors of the language.

MySQL is a DBMS that implements or uses its own flavor of SQL.

References

  1. Hoffer, Jeffrey A., Ramesh V., Topi H. Modern Database Management. Pearson Education, 2010.
  2. “Database — Definition, Examples, Related Words and More at Wordnik.” Wordnik.com, www.wordnik.com/words/database.
  3. Codd, E. F. “A Relational Model of Data for Large Shared Data Banks.” Communications of the ACM, vol. 13, no. 6, 1970, pp. 377–387., doi:10.1145/362384.362685.
  4. Chamberlin, D. D, Boyce, R. F. 1974. SEQUEL: A structured English query language. In Proceedings of the 1974 ACM SIGFIDET (now SIGMOD) workshop on Data description, access and control (SIGFIDET ’74). Association for Computing Machinery, New York, NY, USA, 249–264. DOI:https://doi.org/10.1145/800296.811515
  5. “SQL Trademark Information.” Trademarkia.com, https://trademark.trademarkia.com/sequel-73346503.html
  6. “History of IBM.” IBM.com, https://www.ibm.com/ibm/history/history/year_1978.html
  7. “Oracle V2.” Universität Klagenfurt, http://cs-exhibitions.uni-klu.ac.at/index.php?id=403
  8. “What is Columnar Database? — AWS.” Amazon.com, https://aws.amazon.com/nosql/columnar/
  9. “Amazon Redshift SQL.” Amazon.com, https://docs.aws.amazon.com/redshift/latest/dg/c_redshift-sql.html

Thank you Hannah M. Clark, Mickaylia Johnson, and Tajay Marshall for reading drafts of this.