White paper on Querying with MySQL

White paper on Querying with MySQL

COURTESY :- vrindawan.in

Wikipedia

MySQL (/ˌmˌɛsˌkjuːˈɛl/) is an open-source relational database management system (RDBMS). Its name is a combination of “My”, the name of co-founder Michael Widenius’s daughter My, and “SQL”, the abbreviation for Structured Query Language. A relational database organizes data into one or more data tables in which data may be related to each other; these relations help structure the data. SQL is a language programmers use to create, modify and extract data from the relational database, as well as control user access to the database. In addition to relational databases and SQL, an RDBMS like MySQL works with an operating system to implement a relational database in a computer’s storage system, manages users, allows for network access and facilitates testing database integrity and creation of backups.

MySQL - Wikipedia

MySQL is free and open-source software under the terms of the GNU General Public License, and is also available under a variety of proprietary licenses. MySQL was owned and sponsored by the Swedish company MySQL AB, which was bought by Sun Micro systems (now Oracle Corporation). In 2010, when Oracle acquired Sun, Widenius forked the open-source MySQL project to create MariaDB.

MySQL has stand-alone clients that allow users to interact directly with a MySQL database using SQL, but more often, MySQL is used with other programs to implement applications that need relational database capability. MySQL is a component of the LAMP web application software stack (and others), which is an acronym for Linux, Apache, MySQL, Perl/PHP/Python. MySQL is used by many database-driven web applications, including Drupal, Joomla, phpBB, and WordPress. MySQL is also used by many popular websites, including Facebook, Flickr MediaWiki, Twitter, and YouTube.

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, including AIX, BSDi, FreeBSD, HP-UX, ArcaOS, eComStation, IBM i, IRIX, Linux, macOS, Microsoft Windows, NetBSD, Novell NetWare, OpenBSD, Open Solaris, OS/2 Warp, QNX, Oracle Solaris, Symbian, SunOS, SCO Open Server, SCO Unix Ware, Sanos and Tru64. A port of MySQL to OpenVMS also exists.

The MySQL server software itself and the client libraries use dual-licensing distribution. They are offered under GPL version 2, or a proprietary license.

Support can be obtained from the official manual. Free support additionally is available in different IRC channels and forums. Oracle offers paid support via its MySQL Enterprise products. They differ in the scope of services and in price. Additionally, a number of third party organisations exist to provide support and services.

MySQL has received positive reviews, and reviewers noticed it “performs extremely well in the average case” and that the “developer interfaces are there, and the documentation (not to mention feedback in the real world via Web sites and the like) is very, very good”. It has also been tested to be a “fast, stable and true multi-user, multi-threaded SQL database server”.

MySQL was created by a Swedish company, MySQL AB, founded by Swedes David Axmark, Allan Larsson and Finland Swede Michael “Monty” Widenius. Original development of MySQL by Widenius and Axmark began in 1994. The first version of MySQL appeared on 23 May 1995. It was initially created for personal usage from mSQL based on the low-level language ISAM, which the creators considered too slow and inflexible. They created a new SQL interface, while keeping the same API as mSQL. By keeping the API consistent with the mSQL system, many developers were able to use MySQL instead of the (proprietarily licensed) mSQL antecedent.

On 15 June 2001, NuSphere sued MySQL AB, TcX DataKonsult AB and its original authors Michael (“Monty”) Widenius and David Axmark in U.S District Court in Boston for “breach of contract, tortious interference with third party contracts and relationships and unfair competition”.

In 2002, MySQL AB sued Progress NuSphere for copyright and trademark infringement in United States district court. NuSphere had allegedly violated MySQL AB’s copyright by linking MySQL’s GPL’ed code with NuSphere Gemini table without being in compliance with the license. After a preliminary hearing before Judge Patti Saris on 27 February 2002, the parties entered settlement talks and eventually settled. After the hearing, FSF commented that “Judge Saris made clear that she sees the GNU GPL to be an enforceable and binding license.”

In October 2005, Oracle Corporation acquired Innobase OY, the Finnish company that developed the third-party InnoDB storage engine that allows MySQL to provide such functionality as transactions and foreign keys. After the acquisition, an Oracle press release mentioned that the contracts that make the company’s software available to MySQL AB would be due for renewal (and presumably renegotiation) some time in 2006. During the MySQL Users Conference in April 2006, MySQL AB issued a press release that confirmed that MySQL AB and Inno base OY agreed to a “multi-year” extension of their licensing agreement.

In February 2006, Oracle Corporation acquired Sleepycat Software, makers of the Berkeley DB, a database engine providing the basis for another MySQL storage engine. This had little effect, as Berkeley DB was not widely used, and was dropped (due to lack of use) in MySQL 5.1.12, a pre-GA release of MySQL 5.1 released in October 2006.

In January 2008, Sun Micro systems bought MySQL AB for $1 billion.

In April 2009, Oracle Corporation entered into an agreement to purchase Sun Micro systems, then owners of MySQL copyright and trademark. Sun’s board of directors unanimously approved the deal. It was also approved by Sun’s shareholders, and by the U.S. government on 20 August 2009. On 14 December 2009, Oracle pledged to continue to enhance MySQL as it had done for the previous four years.

A movement against Oracle’s acquisition of MySQL AB, to “Save MySQL” from Oracle was started by one of the MySQL AB founders, Monty Widenius. The petition of 50,000+ developers and users called upon the European Commission to block approval of the acquisition. At the same time, some Free Software opinion leaders (including Pamela Jones of Groklaw, Jan Wilde boer and Carlo Piana, who also acted as co-counsel in the merger regulation procedure) advocated for the unconditional approval of the merger. As part of the negotiations with the European Commission, Oracle committed that MySQL server will continue until at least 2015 to use the dual-licensing strategy long used by MySQL AB, with proprietary and GPL versions available. The antitrust of the EU had been “pressuring it to divest MySQL as a condition for approval of the merger”. But, as revealed by WikiLeaks, the US Department of Justice, at the request of Oracle, pressured the EU to approve the merger unconditionally. The European Commission eventually unconditionally approved Oracle’s acquisition of MySQL AB on 21 January 2010.

In January 2010, before Oracle’s acquisition of MySQL AB, Monty Widenius started a GPL-only fork, MariaDB. MariaDB is based on the same code base as MySQL server 5.5 and aims to maintain compatibility with Oracle-provided versions.

MySQL is offered under two different editions: the open source MySQL Community Server and the proprietary Enterprise Server. MySQL Enterprise Server is differentiated by a series of proprietary extensions which install as server plugins, but otherwise shares the version numbering system and is built from the same code base.

Major features as available in MySQL 5.6:

  • A broad subset of ANSI SQL 99, as well as extensions
  • Cross-platform support
  • Stored procedures, using a procedural language that closely adheres to SQL/PSM
  • Triggers
  • Cursors
  • Updatable views
  • Online Data Definition Language (DDL) when using the InnoDB Storage Engine.
  • Information schema
  • Performance Schema that collects and aggregates statistics about server execution and query performance for monitoring purposes.
  • A set of SQL Mode options to control runtime behavior, including a strict mode to better adhere to SQL standards.
  • X/Open XA distributed transaction processing (DTP) support; two phase commit as part of this, using the default InnoDB storage engine
  • Transactions with savepoints when using the default InnoDB Storage Engine. The NDB Cluster Storage Engine also supports transactions.
  • ACID compliance when using InnoDB and NDB Cluster Storage Engines
  • SSL support
  • Query caching
  • Sub-SELECTs (i.e. nested SELECTs)
  • Built-in replication support
    • Asynchronous replication: master-slave from one master to many slaves or many masters to one slave
    • Semi synchronous replication: Master to slave replication where the master waits on replication
    • Synchronous replication: Multi-master replication is provided in MySQL Cluster.
    • Virtual Synchronous: Self managed groups of MySQL servers with multi master support can be done using: Galera Cluster or the built in Group Replication plugin
  • Full-text indexing and searching
  • Embedded database library
  • Unicode support
  • Partitioned tables with pruning of partitions in optimizer
  • Shared-nothing clustering through MySQL Cluster
  • Multiple storage engines, allowing one to choose the one that is most effective for each table in the application.
  • Native storage engines InnoDB, MyISAM, Merge, Memory (heap), Federated, Archive, CSV, Blackhole, NDB Cluster.
  • Commit grouping, gathering multiple transactions from multiple connections together to increase the number of commits per second.

The developers release minor updates of the MySQL Server approximately every two months. The sources can be obtained from MySQL’s website or from MySQL’s GitHub repository, both under the GPL license.

When using some storage engines other than the default of InnoDB, MySQL does not comply with the full SQL standard for some of the implemented functionality, including foreign key references. Check constraints are parsed but ignored by all storage engines before MySQL version 8.0.15.

Up until MySQL 5.7, triggers are limited to one per action / timing, meaning that at most one trigger can be defined to be executed after an INSERT operation, and one before INSERT on the same table. No triggers can be defined on views.

MySQL database’s inbuilt functions like UNIX_TIMESTAMP() will return 0 after 03:14:07 UTC on 19 January 2038. Recently, there had been an attempt to solve the problem which had been assigned to the internal queue