XI_13_Introduction To MYSQL_IP

Download Report

Transcript XI_13_Introduction To MYSQL_IP

CHAPTER:13
Introduction to MySQL
Prepared By :
VINAY ALEXANDER (विनय अलेक्सजेंड़र)
PGT(CS) ,KV JHAGRAKHAND
Introduction
 MySQL is an open source, free and powerful
Relational Database Management System (DBMS)
that uses SQL.
 It was developed by Michael Widenius and AKA
Monty. It was named after Monty’s daughter My.
The logo of MySQL – the dolphin, is named as
Sakila.
 It is a fast, reliable, scalable alternative to many
of the commercial RDBMS.
 MySQL is created and distributed by MySQL AB,
a company based in Sweden, now part of the Sun
Microsystems.
 It can be freely downloaded from www.mysql.org
An Overview of SQL
• SQL stands for Structured Query Language.
• It is the most commonly used relational
database language today.
• SQL works with a variety of different fourthgeneration (4GL) programming languages,
such as Visual Basic, java etc.
4
Why a query language?
Given some data,
how should users
and computer programs
communicate with it?
?
•we need an interface to the data
 Server: The server listens for client requests
coming in over the network and accesses database
contents according to those requests and provides
that to the clients.
 Clients: It is a programs that connect to the
database server and issue queriws in a prespecified format.
 Key features of MySQL
 Speed: It if faster than most of the commercial
RDBMSs like Oracle, MS SQL Server.
 Free of Cost: It is available free of cost as Open
Source database. It is part of LAMP (Linux, Apache,
MySQL, PHP/ Perl/ Python)
 Portability: It can be installed and run on different
types of Hardware and Operating System platform.
Security: It offers privilege and password
system for authorization.
Connectivity: It may connect various types
of client using different protocols.
Ease of Use: It is simple database system
and offers an interactive environment to
work.
Query Language: It uses SQL (Structured
Query Language) as query language, which
is standardized by ANSI.
MySQL & SQL
 In order to access data from MySQL database, all
program and user must use SQL (Structured Query
Language). SQL is a set of commands that are
recognized by all the RDBMSs and has become a
standard.
 SQL is a language that enables you to create and
manage a relational database, in which all the
information are kept in tables.
 There are numerous version of SQL. The original
version was developed at IBM’s San Jose Research
Laboratory with a name of Sequal, as a part of
System R project in 1970s. It was standardized by
ANSI in 1986 by the name of SQL.
 Catalog: A set of schemas that constitute the description
of a database.
 Schema: The structure that contains descriptions of
objects created by a user (base tables, views, constraints)
Features of SQL- Capabilities
 The processing capabilities of SQL are followings Data Definition Language (DDL): The SQL DDL
provides commands to create, alter and delete database
schema objects like table, views, index etc.[
 Interactive Data Manipulation Language (DML):
These commands are used to insert, delete, update and
retrieve the stored records from the table.
 Embedded Data Manipulation Language: The SQL
DML command can be executed or used in General
Programming Languages like Pascal, C,C++ and JAVA etc.
View Definition: The SQL DDL command
also used to create Views for simplicity and
privacy.
Authorization: The SQL DDL command
also used for specifying access rights to the
Relations (Table) and Views.
Integrity: Various data validation rules
(Integrity constraints) can also implemented by
SQL to insure correctness of data.
Transaction
control:
SQL
includes
commands for specifying the beginning and
ending of transactions along with commands to
have a control over a transaction processing.
 Types of SQL Commands
 The commands of SQL can be categorized in the
followings Data definition language(DDL): A database scheme is
specified by a set of definition which are expressed by a
special language called a data definition language
(DDL).
 The result of compilation of DDL statements is a set
of tables which are stored in a special file called Data
dictionary (or dictionary). i.e. A data dictionary is a file
that contains “Metadata” i.e. , “data about data”
 Data Definition Language (DDL): These SQL
commands are used to create, alter and delete database
objects like table, views, index etc. Example of DDL
Command: CREATE TABLE, CREATE VIEW, CREATE
INDEX, ALTER TABLE, ALTER INDEX, DROP TABLE,
ALTER INDEX , DROP TABLE, RENAME TABLE,
TRUNCATE.
Data Manipulation Language (DML):It is a
language that enables user to access or
manipulate data as organized by the
appropriate data model.
=>By data manipulation, we mean
1.the retrieval of information stored in the
database
2.the insertion of new information into the
database
3.The deletion of information from the
database
4.the modification of data stored in the
database
=>The DML are basically of two types:
1.Procedure DML required a user to
specify what data is needed and how
to get it.
2. Non-procedure DMLs required a
user to specify what data is needed
without specifying how to get it.
=>DML commands are used to insert,
delete, update and retrieve the stored
records from the table. SELECT,
INSERT INTO, DELETE, UPDATE,
SELECT, LOCK …. etc.
 Transaction Control Language (TCL): These
commands are used to control the transaction.
 COMMIT: It makes all the changes made by
statements issued, permanent.
 ROLLBACK: It undoes all changes since the
beginning of a transaction or since a save point.
 SAVEPOINT: It makes a point upto which all
earlier statements have been successfully
completed and if required-in case of failure- one
may undo the changes.i.e., rollback upto up to this
very point
 SET TRANSACTION: It establishes properties
for the current transactions.
=>Data Control Language (DCL): These
commands are used to manipulate permissions
or access rights to the tables etc. GRANT.. ,
REVOKE.