What is MySQL?
description
Transcript of What is MySQL?
![Page 1: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/1.jpg)
What is MySQL?MySQL is a relational database
management system (RDBMS) based on SQL (Structured Query Language). First released in January, 1998. Many Internet startups became interested in the original open source version of MySQL.
![Page 2: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/2.jpg)
What is MySQL? Continue
MySQL is a database system used on the web. Basically, a MySQL database allows you to create a relational database structure on a web-server somewhere in order to store data or automate procedures.
![Page 3: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/3.jpg)
Installing MySQL on Windows These instructions are for version 5.1
(mysql-5.1.51-win32) 1. Download the current version of
MySQL from http://www.mysql.com. 2. Double-click setup.exe to launch the
installer.
![Page 4: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/4.jpg)
3 .At the Welcome screen of the Setup Wizard click Next.
![Page 5: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/5.jpg)
4 .Choose the Typical option as the setup type and click Next .
![Page 6: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/6.jpg)
5 .Click Install.
![Page 7: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/7.jpg)
6.a. Click Next.
![Page 8: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/8.jpg)
6.b. Click Next.
![Page 9: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/9.jpg)
7 .The MySQL Server Database Engine is now installed. At this point the server must be configured, choose the Configure the MySQL Server now option and click Finish.
![Page 10: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/10.jpg)
8 .At the Welcome screen of the MySQL Server Instance Configuration Wizard, click Next.
![Page 11: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/11.jpg)
9 .Choose the Detailed Configuration option and click Next.
![Page 12: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/12.jpg)
10 .Choose the Developer Machine option and click Next.
![Page 13: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/13.jpg)
11 .Choose the database usage type that best describes your installation. If you are unsure, choose the Multifunctional Database option and click Next.
![Page 14: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/14.jpg)
12 .Choose a location that will house the database tablespace and click Next. If the current machine will be used to store the Portfolio catalog, the default location will work fine.
![Page 15: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/15.jpg)
13 .This step of the Wizard allows you to help optimize the database for the number of concurrent connections that you expect to have to a Portfolio catalog .
If you are not sure how many concurrent users you will have, choose the Online Transaction Processing (OLTP) option
But we will choose the Decision Support (DSS)/OLAP option and click Next.
![Page 16: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/16.jpg)
14 .Choose the Enable TCP/IP Networking option , Enable Strict Mode and click Next.
![Page 17: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/17.jpg)
15 .Choose the Best Support for Multilingualism option and click Next.
![Page 18: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/18.jpg)
16 .To run MySQL server as a service, check the Install as a Windows Service option and choose a Service Name. It is also recommended to launch the MySQL Service automatically, check the Include Bin Directory in Windows PATH and click Next.
![Page 19: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/19.jpg)
17 .In this step you choose enable the root user and choose a password. Check the Modify Security Settings option, then enter and confirm the new root user password. When finished, click Next.
![Page 20: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/20.jpg)
18 .Click Execute to configure the MySQL instance.
![Page 21: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/21.jpg)
19 .Click Finish to close the Wizard.
![Page 22: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/22.jpg)
Launching MySQL
![Page 23: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/23.jpg)
There are to ways to launch this program :1. Start --> Run --> cmd
![Page 24: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/24.jpg)
![Page 25: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/25.jpg)
2. Start --> All Program --> MySQL --> MySQL Server 5.0 --> MySQL Command Line Client
![Page 26: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/26.jpg)
![Page 27: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/27.jpg)
Table
“A table is the primary unit of physical storage for data in a database.”1
Usually a database contains more than one table.
![Page 28: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/28.jpg)
Table
![Page 29: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/29.jpg)
Field (Column)
a field
Customers
![Page 30: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/30.jpg)
Record (Row)
a record
Customers
![Page 31: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/31.jpg)
Primary Key
primary key field
Customers
Primary key is a unique identifier of records in a table.
Primary key values may be generated manually or automatically.
![Page 32: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/32.jpg)
Primary Key
primary key fields
Roles (Performances)
A primary key can consist of more than one field.
![Page 33: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/33.jpg)
Foreign Key
foreign key field
primary key fieldparent table
Directors
Movieschild tablerelationship
![Page 34: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/34.jpg)
![Page 35: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/35.jpg)
Conceptual Data Models
Use concepts such as entities, attributes, and relationships
An entity represents a real world object or concept.
An attribute represents some property of an entity.
A relationship among two or more entities represents an interaction among the entities.
![Page 36: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/36.jpg)
Relationship Types
One-to-one
One-to-many
Many-to-many
![Page 37: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/37.jpg)
One-to-Many A film is directed by at most one director A director can direct any number of films
Directorid
name
Directed Film title
Director Directed Film
![Page 38: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/38.jpg)
Many-to-Many A film is directed by any number of directors A director can direct any number of films
Directorid
name
Directed Film title
Director Directed Film
![Page 39: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/39.jpg)
One-to-One A film is directed by at most one director A director can direct at most one film
Directorid
name
Directed Film title
Director Directed Film
![Page 40: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/40.jpg)
![Page 41: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/41.jpg)
![Page 42: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/42.jpg)
Download mysql-workbench from http://www.mysql.com.
(mysql-workbench-gpl-5.2.28-win32_5)
![Page 43: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/43.jpg)
Select (open connection to start querying)
![Page 44: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/44.jpg)
Press OK, then enter your password
![Page 45: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/45.jpg)
show databases;
![Page 46: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/46.jpg)
create database New_database;
![Page 47: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/47.jpg)
show databases;
![Page 48: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/48.jpg)
use new_database;
![Page 49: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/49.jpg)
How to create tables
Use create
create table <table_name> (column_name data_type [not null] … , column_name data_type [not null], primary key (column_name));
To show the structure of the table
describe <table_name>;
![Page 50: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/50.jpg)
Example
![Page 51: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/51.jpg)
Insert RecordINSERT INTO table_name SET
col_name1=value1, col_name2=value2, col_name3=value3, …;
Example
![Page 52: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/52.jpg)
SELECT
mysql> SELECT col_name1 FROM table_name;
![Page 53: What is MySQL?](https://reader036.fdocuments.in/reader036/viewer/2022062409/56814937550346895db67a67/html5/thumbnails/53.jpg)
mysql> SELECT * FROM table_name;