SlideShare a Scribd company logo
Introduction To
Databases
Basicprogramming experience
WHAT ARE Databases?
 PHP mysql  Introduction database
 PHP mysql  Introduction database
size
ease of updating
accuracy
security
redundancy
importance
size
ease of updating
accuracy
security
redundancy
importance
 PHP mysql  Introduction database
size
ease of updating
accuracy
security
redundancy
importance
size
ease of updating
accuracy
security
redundancy
importance
 PHP mysql  Introduction database
size
ease of updating
accuracy
security
redundancy
importance
size
ease of updating
accuracy
security
redundancy
importance
 PHP mysql  Introduction database
size
ease of updating
accuracy
security
redundancy
importance
size
ease of updating
accuracy
security
redundancy
importance
 PHP mysql  Introduction database
size
ease of updating
accuracy
security
redundancy
importance
size
ease of updating
accuracy
security
redundancy
importance
 PHP mysql  Introduction database
size
ease of updating
accuracy
security
redundancy
importance
size
ease of updating
accuracy
security
redundancy
importance
 PHP mysql  Introduction database
size
ease of updating
accuracy
security
redundancy
importance
Database Management Systems(DBMS)
Oracle
SQL Server
MySQL
PostgreSQL
MongoDB
…
DBMS
Software
database database
Other DBMS
Relational database features
table table
table
database
table
columns
rows
 PHP mysql  Introduction database
table
columns
rows
FirstName LastName HireDate Grade Salary City
table
columns
rows
FirstName
(text)
LastName
(text)
HireDate
(Date)
Grade
(numeric)
Salary
(currency)
City
(text)
table
columns
rows
FirstName
(text)
LastName
(text)
HireDate
(Date)
Grade
(numeric)
Salary
(currency)
City
(text)
James Black 03/10/2014 7 15000 HYD
table
columns
rows
FirstName
(text)
LastName
(text)
HireDate
(Date)
Grade
(numeric)
Salary
(currency)
City
(text)
FirstName LastName 03/10/2013 8 15000 CA
James Black 03/10/2014 7 15000 HYD
FirstName LastName 03/10/2013 8 15000 CA
FirstName LastName 03/10/2013 8 15000 CA
FirstName LastName 03/10/2013 8 15000 CA
table
columns
rows
WHAT IS A DATABASE?
•A database is a bunch of information
–It is a structured collection of information
–It contains basic objects, called records or entries
–The records contain fields, which contain defined types of
data, somehow related to that record.
–A university database would contain for example all kinds
of students as records, and students properties (ID,name,
etc) as fields.
WHAT IS A DATABASE?
•A database is searchable
–It contains an index (table of content, catalog)
•It is updated regularly
–New data goes in
•Obsolete, old data goes out
–It is cross referenced To other databases
WHY DATABASES?
•The main purpose of databases is not only to collect and
organize data, but to allow advanced data retrieval and
analysis
•A database query is a method to retrieve information from the
database
•The organization of records into fields allows us to use
queries on fields.
DATABASES ON THE INTERNET
USER
DATABASE
SERVER
WEBSERVERS
Introduction to MySQL
ROAD MAP
•Introduction to MySQL
•Connecting and Disconnecting
•Entering Basic Queries
•Creating and Using a Database
MySQL
•MySQL is a very popular, open source database.
•Officially pronounced “my Ess Que Ell” (not my sequel).
•Handles very large databases; very fast performance.
•Why are we using MySQL?
–Free (much cheaper than Oracle!)
–Each student can install MySQL locally.
–Easy to use Shell for creating tables, querying tables, etc.
–Easy to use with PHP
CONNECTING TO MYSQL
•MySQL provides an interactive shell for creating tables,
inserting data, etc.
•On Windows, just go to c:mysqlbin, and type:
•Mysql –u root -p
•Or, click on the Windows icon
SAMPLE SESSION
 For example:
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 241 to server version: 3.23.49
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql>
 To exit the MySQL Shell, just type QUIT or EXIT:
mysql> QUIT
mysql> exit
BASIC QUERIES
 Once logged in, you can try some simple queries.
 For example:
mysql> SELECT VERSION(), CURRENT_DATE;
+-----------+--------------+
| VERSION() | CURRENT_DATE |
+-----------+--------------+
| 3.23.49 | 2002-05-26 |
+-----------+--------------+
1 row in set (0.00 sec)
 Note that most MySQL commands end with a semicolon (;)
 MySQL returns the total number of rows found, and the total time to
execute the query.
BASIC QUERIES
 Keywords may be entered in any lettercase.
 The following queries are equivalent:
mysql> SELECT VERSION(), CURRENT_DATE;
mysql> select version(), current_date;
mysql> SeLeCt vErSiOn(), current_DATE;
BASIC QUERIES
 Here's another query. It demonstrates that you
can use mysql as a simple calculator:
mysql> SELECT SIN(PI()/4), (4+1)*5;
+-------------+---------+
| SIN(PI()/4) | (4+1)*5 |
+-------------+---------+
| 0.707107 | 25 |
+-------------+---------+
BASIC QUERIES
 You can also enter multiple statements on a
single line. Just end each one with a semicolon:
mysql> SELECT VERSION(); SELECT NOW();
+--------------+
| VERSION() |
+--------------+
| 3.22.20a-log |
+--------------+
+---------------------+
| NOW() |
+---------------------+
| 2004 00:15:33 |
+---------------------+
MULTI-LINE COMMANDS
 mysql determines where your statement ends by
looking for the terminating semicolon, not by
looking for the end of the input line.
 Here's a simple multiple-line statement:
mysql> SELECT
-> USER()
-> ,
-> CURRENT_DATE;
+--------------------+--------------+
| USER() | CURRENT_DATE |
+--------------------+--------------+
| joesmith@localhost | 1999-03-18 |
+--------------------+--------------+
CANCELING A COMMAND
 If you decide you don't want to execute a
command that you are in the process of entering,
cancel it by typing c
mysql> SELECT
-> USER()
-> c
mysql>
USING A DATABASE
 To get started on your own database, first check
which databases currently exist.
 Use the SHOW statement to find out which
databases currently exist on the server:
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.01 sec)
USING A DATABASE
 To create a new database, issue the “create
database” command:
 mysql> create database webdb;
 To the select a database, issue the “use” command:
 mysql> use webdb;
CREATING A TABLE
 Let’s create a table for storing pets.
 Table: pets
 name: VARCHAR(20)
 owner: VARCHAR(20)
 species: VARCHAR(20)
 gender: CHAR(1)
 birth: DATE
 date: DATE
CREATING A TABLE
 To create a table, use the CREATE TABLE
command:
mysql> CREATE TABLE pet (
-> name VARCHAR(20),
-> owner VARCHAR(20),
-> species VARCHAR(20),
-> gender CHAR(1),
-> birth DATE, death DATE);
Query OK, 0 rows affected (0.04 sec)
SHOWING TABLES
 To verify that the table has been created:
mysql> show tables;
+------------------+
| Tables_in_test |
+------------------+
| pet |
+------------------+
1 row in set (0.01 sec)
DESCRIBING TABLES
 To view a table structure, use the DESCRIBE
command:
mysql> describe pet;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name | varchar(20) | YES | | NULL | |
| owner | varchar(20) | YES | | NULL | |
| species | varchar(20) | YES | | NULL | |
| sex | char(1) | YES | | NULL | |
| birth | date | YES | | NULL | |
| death | date | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
6 rows in set (0.02 sec)
DELETING A TABLE
 To delete an entire table, use the DROP
TABLE command:
mysql> drop table pet;
Query OK, 0 rows affected (0.02 sec)

More Related Content

What's hot (19)

PPT
Working with Databases and MySQL
Nicole Ryan
 
PPS
Introduction to Mysql
Tushar Chauhan
 
PPTX
Introduction databases and MYSQL
Naeem Junejo
 
PDF
4.3 MySQL + PHP
Jalpesh Vasa
 
PPTX
Beginner guide to mysql command line
Priti Solanki
 
ODP
Database Connection With Mysql
Harit Kothari
 
PPT
Php with MYSQL Database
Computer Hardware & Trouble shooting
 
DOC
My sql technical reference manual
Mir Majid
 
PDF
MySQL For Oracle Developers
Ronald Bradford
 
PDF
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
Dave Stokes
 
PDF
Mysql tutorial 5257
Phuong Do Anh
 
PPTX
android sqlite
Deepa Rani
 
PDF
Open Source World June '21 -- JSON Within a Relational Database
Dave Stokes
 
PPTX
Discover the Power of the NoSQL + SQL with MySQL
Dave Stokes
 
PDF
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
Dave Stokes
 
PPTX
Python SQite3 database Tutorial | SQlite Database
ElangovanTechNotesET
 
PPT
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
Working with Databases and MySQL
Nicole Ryan
 
Introduction to Mysql
Tushar Chauhan
 
Introduction databases and MYSQL
Naeem Junejo
 
4.3 MySQL + PHP
Jalpesh Vasa
 
Beginner guide to mysql command line
Priti Solanki
 
Database Connection With Mysql
Harit Kothari
 
Php with MYSQL Database
Computer Hardware & Trouble shooting
 
My sql technical reference manual
Mir Majid
 
MySQL For Oracle Developers
Ronald Bradford
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
Dave Stokes
 
Mysql tutorial 5257
Phuong Do Anh
 
android sqlite
Deepa Rani
 
Open Source World June '21 -- JSON Within a Relational Database
Dave Stokes
 
Discover the Power of the NoSQL + SQL with MySQL
Dave Stokes
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
Dave Stokes
 
Python SQite3 database Tutorial | SQlite Database
ElangovanTechNotesET
 
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 

Viewers also liked (20)

PDF
Designing For Ajax
Bill Scott
 
PDF
Building Large jQuery Applications
Rebecca Murphey
 
PDF
Beginning Jquery In Drupal Theming
Rob Knight
 
PDF
Ajax for PHP Developers
Michael Girouard
 
PDF
BITS: Introduction to relational databases and MySQL - SQL
BITS
 
PDF
MySQL Query Optimization (Basics)
Karthik .P.R
 
PPTX
MySQL Introduction
mysql content
 
PPTX
Understanding angular js
Aayush Shrestha
 
PDF
jQuery for beginners
Arulmurugan Rajaraman
 
PDF
Learning jQuery in 30 minutes
Simon Willison
 
PDF
Introduction to MySQL
Giuseppe Maxia
 
PPT
MySQL Atchitecture and Concepts
Tuyen Vuong
 
PPT
User Interface Design in Software Engineering SE15
koolkampus
 
PDF
Mysql introduction
Prof. Wim Van Criekinge
 
PDF
Software engineering lecture notes
Siva Ayyakutti
 
PPTX
Priciples of management ppt final
rajakamalesha
 
PDF
VISIONS OF THE FUTURE Little Rock 2016
Brian Housand
 
PPT
Management ppt
Yen Garcia
 
PPTX
MySQL DBA OCP 1Z0-883
Kwaye Kant
 
PPT
Basic concept of management
vishalarvindbhole
 
Designing For Ajax
Bill Scott
 
Building Large jQuery Applications
Rebecca Murphey
 
Beginning Jquery In Drupal Theming
Rob Knight
 
Ajax for PHP Developers
Michael Girouard
 
BITS: Introduction to relational databases and MySQL - SQL
BITS
 
MySQL Query Optimization (Basics)
Karthik .P.R
 
MySQL Introduction
mysql content
 
Understanding angular js
Aayush Shrestha
 
jQuery for beginners
Arulmurugan Rajaraman
 
Learning jQuery in 30 minutes
Simon Willison
 
Introduction to MySQL
Giuseppe Maxia
 
MySQL Atchitecture and Concepts
Tuyen Vuong
 
User Interface Design in Software Engineering SE15
koolkampus
 
Mysql introduction
Prof. Wim Van Criekinge
 
Software engineering lecture notes
Siva Ayyakutti
 
Priciples of management ppt final
rajakamalesha
 
VISIONS OF THE FUTURE Little Rock 2016
Brian Housand
 
Management ppt
Yen Garcia
 
MySQL DBA OCP 1Z0-883
Kwaye Kant
 
Basic concept of management
vishalarvindbhole
 
Ad

Similar to PHP mysql Introduction database (20)

PPT
MySql slides (ppt)
webhostingguy
 
PDF
Mysql basics1
Steffy Robert
 
PPT
My sql1
Akash Gupta
 
PPTX
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
Dave Stokes
 
PPTX
MySql:Basics
DataminingTools Inc
 
PPTX
MySQL Basics
mysql content
 
PDF
All Things Open 2016 -- Database Programming for Newbies
Dave Stokes
 
PPT
mysqlHiep.ppt
webhostingguy
 
PPT
MySQL Database System Hiep Dinh
webhostingguy
 
PDF
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Tesora
 
PPTX
Designer's Favorite New Features in SQLServer
Karen Lopez
 
PDF
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
Dave Stokes
 
PDF
Instalar MySQL CentOS
Moisés Elías Araya
 
PPTX
A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...
Karen Lopez
 
PDF
NCTU ppt 2023-2024_WEEK2-SQL Basics (1) (1).pdf
Amany Saeed
 
DOCX
database-querry-student-note
Leerpiny Makouach
 
PPTX
Interfacing python to mysql (11363255151).pptx
cavicav231
 
PPT
Mysql database
Arshikhan08
 
MySql slides (ppt)
webhostingguy
 
Mysql basics1
Steffy Robert
 
My sql1
Akash Gupta
 
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
Dave Stokes
 
MySql:Basics
DataminingTools Inc
 
MySQL Basics
mysql content
 
All Things Open 2016 -- Database Programming for Newbies
Dave Stokes
 
mysqlHiep.ppt
webhostingguy
 
MySQL Database System Hiep Dinh
webhostingguy
 
Percona Live 4/15/15: Transparent sharding database virtualization engine (DVE)
Tesora
 
Designer's Favorite New Features in SQLServer
Karen Lopez
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
Dave Stokes
 
Instalar MySQL CentOS
Moisés Elías Araya
 
A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...
Karen Lopez
 
NCTU ppt 2023-2024_WEEK2-SQL Basics (1) (1).pdf
Amany Saeed
 
database-querry-student-note
Leerpiny Makouach
 
Interfacing python to mysql (11363255151).pptx
cavicav231
 
Mysql database
Arshikhan08
 
Ad

More from Mudasir Syed (20)

PPT
Error reporting in php
Mudasir Syed
 
PPT
Cookies in php lecture 2
Mudasir Syed
 
PPT
Cookies in php lecture 1
Mudasir Syed
 
PPTX
Ajax
Mudasir Syed
 
PPT
Reporting using FPDF
Mudasir Syed
 
PPT
Oop in php lecture 2
Mudasir Syed
 
PPT
Oop in php lecture 2
Mudasir Syed
 
PPT
Filing system in PHP
Mudasir Syed
 
PPT
Time manipulation lecture 2
Mudasir Syed
 
PPT
Time manipulation lecture 1
Mudasir Syed
 
PPT
Php Mysql
Mudasir Syed
 
PPT
Adminstrating Through PHPMyAdmin
Mudasir Syed
 
PPT
Sql select
Mudasir Syed
 
PPT
PHP mysql Sql
Mudasir Syed
 
PPT
PHP mysql Mysql joins
Mudasir Syed
 
PPT
PHP mysql Installing my sql 5.1
Mudasir Syed
 
PPT
PHP mysql Er diagram
Mudasir Syed
 
PPT
PHP mysql Database normalizatin
Mudasir Syed
 
PPT
PHP mysql Aggregate functions
Mudasir Syed
 
PPT
Form validation with built in functions
Mudasir Syed
 
Error reporting in php
Mudasir Syed
 
Cookies in php lecture 2
Mudasir Syed
 
Cookies in php lecture 1
Mudasir Syed
 
Reporting using FPDF
Mudasir Syed
 
Oop in php lecture 2
Mudasir Syed
 
Oop in php lecture 2
Mudasir Syed
 
Filing system in PHP
Mudasir Syed
 
Time manipulation lecture 2
Mudasir Syed
 
Time manipulation lecture 1
Mudasir Syed
 
Php Mysql
Mudasir Syed
 
Adminstrating Through PHPMyAdmin
Mudasir Syed
 
Sql select
Mudasir Syed
 
PHP mysql Sql
Mudasir Syed
 
PHP mysql Mysql joins
Mudasir Syed
 
PHP mysql Installing my sql 5.1
Mudasir Syed
 
PHP mysql Er diagram
Mudasir Syed
 
PHP mysql Database normalizatin
Mudasir Syed
 
PHP mysql Aggregate functions
Mudasir Syed
 
Form validation with built in functions
Mudasir Syed
 

Recently uploaded (20)

PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
PDF
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
PDF
Council of Chalcedon Re-Examined
Smiling Lungs
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PPTX
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
PPTX
Controller Request and Response in Odoo18
Celine George
 
PDF
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PDF
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PDF
epi editorial commitee meeting presentation
MIPLM
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
Council of Chalcedon Re-Examined
Smiling Lungs
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
Controller Request and Response in Odoo18
Celine George
 
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
epi editorial commitee meeting presentation
MIPLM
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 

PHP mysql Introduction database