What Is MySQL
What Is MySQL
ABOUT MYSQL
A relational database stores data in separate tables rather than putting all the
data in one big storeroom. This adds speed and flexibility. The SQL part of
"MySQL" stands for "Structured Query Language." SQL is the most common
standardized language used to access databases and is defined by the ANSI/ISO
SQL Standard. The SQL standard has been evolving since 1986 and several
versions exist. In this manual, "SQL-92" refers to the standard released in1992,
"SQL:1999" refers to the standard released in 1999, and"SQL:2003" refers to the
current version of the standard.
1
MySQL software is open source.
Open Source means that it is possible for anyone to use andmodify the software.
Anybody can download the MySQL softwarefrom the Internet and use it without
paying anything. If you wish,you may study the source code and change it to suit
your needs. The MySQL software uses the GPL (GNU General Public License).
If that is what you are looking for, you should give it a try. MySQL Server also has
a practical set of features developed in close cooperation with our users. You can
find a performance comparison of MySQL Server with other database managers
on our benchmark page. MySQL Server was originally developed to handle large
databases much faster than existing solutions and has been successfully used in
highly demanding production environments for several years. Although under
constant development, MySQL Server today offers a rich and useful set of
functions. Its connectivity, speed, and security make MySQL Server highly suited
for accessing databases on the Internet. MySQL Server works in client/server or
embedded systems. The MySQL Database Software is a client/server system that
consists of a multi-threaded SQL server that supports different backbend’s,
several different client programs and libraries, administrative tools, and a wide
range of application programming interfaces (APIS).
2
Implements SQL functions using a highly optimized class library that should be
as fast as possible. Usually there is no memory allocation at all after query
initialization.
Provides the server as a separate program for use in a client/server networked
environment, and as a library that can be embedded (linked) into standalone
applications. Such applications can be used in isolation or in environments
where no network is available. Password security by encryption of all password
traffic when you connect to a server.
Support for large databases. We use MySQL Server with databasesthat contain
50 million records. We also know of users who useMySQL Server with 200,000
tables and about 5,000,000,000 rows.
MySQL client programs can be written in many languages. A clientlibrary
written in C is available for clients written in C or C++, or forany language that
provides C bindings.
APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby, and Tcl areavailable,
enabling MySQL clients to be written in many languages.
The Connector/ODBC (My ODBC) interface provides MySQL supportfor client
programs that use ODBC (Open Database Connectivity)connections.
The Connector/J interface provides MySQL support for Java clientprograms
that use JDBC connections. Clients can be run on Windowsor Unix. Connector/J
source is available.
3
What is database?
Introduction and concepts
A Primary key is one or more fields whose value or values uniquelyidentify each
record in a table. In a relationship, a primary key isused to refer to specific record
in one table from another table. Aprimary key is called foreign key when it is
referred to from anothertable.
To find and retrieve just the data that meets conditions you specify,including data
from multiple tables, create a query. A query can alsoupdate or delete multiple
records at the same time, and performbuilt-in or custom calculations on your
data.
4
management system, therefore, is a combination of hardwareand software that
can be used to set up and monitor a database, andcan manage the updating and
retrieval of database that has been stored in it
5
UNDERSTANDING THE PYTHON MYSQL
DATABASE CONNECTION PROGRAM
import mysql.connector
✓This line imports the MySQL connector python module in the program MySQL.
Connector Error object is used to show an error when we fail to connect database
object
MySQL.connector.connect()
✓connect(): This method is used for creating aconnection to our database it has
four arguments:
Host Name
Database User Name
Database Password
Database Name
connection.cursor()
✓ cursor(): This method creates a cursor object that iscapable for executing sql
query on database.
execute(): This method is used for executing sql query ondatabase. It takes a
sql query (as string) as an argument.
6
Read operation
✓fetchone()- It fetches the next row of a query result set.A result set is an object
that is returned when a cursor objectis used to query a table
✓fetchall() - It fetches all the rows in a result set.If some rows have already been
extracted from the result setthen it retrieves the remaining rows from the result
set