SlideShare a Scribd company logo
1
Internet Programming
Database(SQL and MySQL)
2
Objectives
To understand the relational database model.
queries database using SQL (Structured Query
Language).
To understand the MySQL database server.
To learn various database interfaces.
3
Introduction
Database
 An integrated collection of data
Database Management System (DBMS)
 Provides mechanism for storing and organizing data
in a manner that is consistent with the database’s
format.
The most popular database systems are
relational database
 Use a language called SQL (Structured Query
Language)
4
Introduction
Popular database systems
 Microsoft SQL Server, OracleTM
, SybaseTM
InformixTM
andMySQLTM.
An interface
 Software that facilitates communication
between a database management system
and a program.
 Examples: Perl DBI for Perl, DB-API for
Python and dbx module for PHP.
5
Relational Database Model
A logical presentation of data.
Allows relationships among items of the
data.
Does not concern about the physical
structure of the data.
Is composed of tables
 Tables are composed of rows and columns
 Has primary key for referencing data
6
Relational Database Model
Database
Student_Record
Table : Student_Details
Table : Score
Table : Medical
Table : Activities
7
Relational Database Model
stud_ID stud_name age cgpa
1111 Lily 19 3.40
2222 Kim 18 2.75
3333 Ali 21 3.00
Database Name: Student_Record
Table Name: Score
Primary key
A major strength of the relational model:
supports simple, powerful querying of data.
8
SQL (Structured Query Language)
Developed by IBM in the 1970s.
Two Categories of SQL Statement.
1. Data manipulation
• SELECT, INSERT, DELETE
2. Data definition
• CREATE DATABASE, DROP DATABASE
• CREATE TABLE, DROP TABLE
9
Basic SELECT Query
SELECT column_name
FROM table_name
WHERE condition;
Select all columns from a table
 SELECT * FROM table_name
 SELECT * FROM Score
Select specific column(s) from a table
 SELECT student_name FROM Score
 SELECT student_name, age FROM Score
10
Basic SELECT Query
Specify the selection criteria for the query.
 SELECT student_id, cgpa
FROM Score
WHERE age > 18;
Use pattern matching to search for similar
strings
 SELECT student_id, cgpa
FROM Score
WHERE student_name LIKE ‘K*’;
11
Basic SELECT Query
Use pattern matching to search for strings in which
exactly ONE character takes the selected
character(?) place
 SELECT student_id, cgpa
FROM Score
WHERE student_name LIKE ‘?i*’; 2nd
letter
Arrange in ascending or descending order
 SELECT column_name1, column_name2,…
FROM table_name
ORDER BY column_name ASC;
12
Basic SELECT Query
Arrange in ascending or descending order
 SELECT column_name1, column_name2,…
FROM table_name
ORDER BY column_name DESC;
 SELECT student_ID, student_name, cgpa
FROM Score
ORDER BY student_name DESC;
13
Basic SELECT Query
Arrange rows in ascending order by multiple
columns
 SELECT column_name1, column_name2,...
FROM table_name
ORDER BY column_name1 SortingOrder1,
column_name2 SortingOrder2,... ;
 SELECT student_ID, student_name, cgpa
FROM Score
ORDER BY student_name, age
14
Use SELECT to join tables
Use an INNER JOIN to merge rows from
two or more tables by testing for matching
values.
 SELECT column_name1, column_name2,...
FROM table_name1
INNER JOIN table_name2
ON table_name1.column_name =
table_name2.column_name;
15
Use SELECT to join tables
 SELECT student_name, blood_group,...
FROM Score
INNER JOIN Medical
ON Score.student_ID = Medical.student_ID
ORDER BY student_name;
The query combines the student_name and cgpa
columns from table Score and column
blood_group from table Medical, sorting the result
in ascending order by student_name
16
Use SELECT to join tables
SELECT table_name1.colx,
table_name2.coly...
FROM table_name1, table_name2
WHERE condition;
SELECT Score.student_name, Score.cgpa,
Medical.blood_group
FROM Score, Medical
WHERE Score.student_ID = Medical.student_ID;
17
SQL Statement: INSERT
INSERT INTO table_name
(col1, col2, col3, ...)
VALUES
(‘text1’,’text2’...,num1,…);
INSERT INTO Score (student_id, cgpa)
VALUES(4444, 3.5);
INSERT INTO Score
VALUES(4444,’John’,19,3.5);
18
SQL Statement: DELETE
DELETE FROM table_name
WHERE condition;
 DELETE FROM Score
WHERE student_name=‘Lily’;
19
SQL Statement: UPDATE
UPDATE table_name
SET column_name1 = value1,
column_name2 = value2,
…
WHERE criteria;
UPDATE Score
SET student_name = ‘Kimchi’,
age = 20,
WHERE student_ID = 3333;
20
MySQL
Multiuser, multithreaded RDBMS server
Uses SQL to interact with and manipulate
data
Few important features
 Enable multiple tasks concurrently – requesting
process is more efficient
 Support various programming language
 Available for all common platforms
 Full support of functions and operators to
manipulate data
 Accessing tables from different database using a
single query
 Able to handle large database
21
MySQL
22
Add table
Table Name
TAB1033 - Internet Programming 23
Create Table fields
TAB1033 - Internet Programming 24
Table in MySQL
25
Introduction to Database Interface
Perl Database Interface (DBI)
 Enables user to access relational database from
Perl program.
 Database independent – allows migration among
DBMS
 Uses object-oriented interface – handles
PHP dbx module
 An XHTML-embedded scripting language
 Database interface that does not interact with
database directly
 It interacts with one of several database-specific
module
26
Introduction to DBI
Phyton DB-API
 Database Application Programming
Interface
 Consists of :
 Connection data object – access the database
 Cursor data object – manipulate and retrieve
data
 Portable across several databases
27
ADO.NET Object Model
Provides an API for accessing database
systems programmatically.
Was created for .NET framework
Was designed to interact with
Microsoft’s Component Object ModelTM
(COM) framework.
Further reading : Textbook, page 736
28
Summary
What is database?
The most popular database – relational
database
SQL for database queries
Database consists table(s)
Two Categories of SQL Statement.
1. Data manipulation
• SELECT, INSERT, DELETE,UPDATE
2. Data definition
DBI – Perl DBI, PHP dbx module, Python DB-
API
ADO.NET object Model

More Related Content

What's hot

Mca ii-dbms- u-ii-the relational database model
Mca ii-dbms- u-ii-the relational database modelMca ii-dbms- u-ii-the relational database model
Mca ii-dbms- u-ii-the relational database model
Rai University
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
CPD INDIA
 
Sql – Structured Query Language
Sql – Structured Query LanguageSql – Structured Query Language
Sql – Structured Query Language
pandey3045_bit
 
Database queries
Database queriesDatabase queries
Database queries
IIUM
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Model
oudesign
 
12 SQL
12 SQL12 SQL
Dbms
DbmsDbms
Database management system
Database management systemDatabase management system
Database management system
edudivya
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
Archit Saxena
 
Rdbms
RdbmsRdbms
Sql - Structured Query Language
Sql - Structured Query LanguageSql - Structured Query Language
Sql - Structured Query Language
Wan Hussain Wan Ishak
 
DATA BASE MODEL Rohini
DATA BASE MODEL RohiniDATA BASE MODEL Rohini
Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)
Rakibul Hasan Pranto
 
Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1
Eddyzulham Mahluzydde
 
RDBMS
RDBMSRDBMS
SQL
SQL SQL
Introduction DBMS, RDBMS and SQL
Introduction DBMS, RDBMS and SQLIntroduction DBMS, RDBMS and SQL
Introduction DBMS, RDBMS and SQL
Murageppa-QA
 

What's hot (17)

Mca ii-dbms- u-ii-the relational database model
Mca ii-dbms- u-ii-the relational database modelMca ii-dbms- u-ii-the relational database model
Mca ii-dbms- u-ii-the relational database model
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
 
Sql – Structured Query Language
Sql – Structured Query LanguageSql – Structured Query Language
Sql – Structured Query Language
 
Database queries
Database queriesDatabase queries
Database queries
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Model
 
12 SQL
12 SQL12 SQL
12 SQL
 
Dbms
DbmsDbms
Dbms
 
Database management system
Database management systemDatabase management system
Database management system
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Rdbms
RdbmsRdbms
Rdbms
 
Sql - Structured Query Language
Sql - Structured Query LanguageSql - Structured Query Language
Sql - Structured Query Language
 
DATA BASE MODEL Rohini
DATA BASE MODEL RohiniDATA BASE MODEL Rohini
DATA BASE MODEL Rohini
 
Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)Islamic University Previous Year Question Solution 2018 (ADBMS)
Islamic University Previous Year Question Solution 2018 (ADBMS)
 
Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1Chapter 2 Relational Data Model-part1
Chapter 2 Relational Data Model-part1
 
RDBMS
RDBMSRDBMS
RDBMS
 
SQL
SQL SQL
SQL
 
Introduction DBMS, RDBMS and SQL
Introduction DBMS, RDBMS and SQLIntroduction DBMS, RDBMS and SQL
Introduction DBMS, RDBMS and SQL
 

Similar to PHP - Getting good with MySQL part I

Oracle SQL Part1
Oracle SQL Part1Oracle SQL Part1
Oracle SQL Part1
Gurpreet singh
 
sql_data.pdf
sql_data.pdfsql_data.pdf
sql_data.pdf
VandanaGoyal21
 
7. SQL.pptx
7. SQL.pptx7. SQL.pptx
7. SQL.pptx
chaitanya149090
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
Chirag vasava
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
ChryslerPanaguiton
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
ChryslerPanaguiton
 
Introduction to Oracle
Introduction to OracleIntroduction to Oracle
Introduction to Oracle
Achmad Solichin
 
Introduction to Oracle
Introduction to OracleIntroduction to Oracle
Introduction to Oracle
Achmad Solichin
 
Intro
IntroIntro
MIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresMIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome Measures
Steven Johnson
 
MS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsMS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutions
RSolutions
 
DATABASE LANGUAGES; DDL, DML, TCL, ETC..
DATABASE LANGUAGES; DDL, DML, TCL, ETC..DATABASE LANGUAGES; DDL, DML, TCL, ETC..
DATABASE LANGUAGES; DDL, DML, TCL, ETC..
MunawarAhmad22
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
Danish Mehraj
 
Database Management System ppt
Database Management System pptDatabase Management System ppt
Database Management System ppt
OECLIB Odisha Electronics Control Library
 
csedatabasemanagementsystemppt-170825044344.pdf
csedatabasemanagementsystemppt-170825044344.pdfcsedatabasemanagementsystemppt-170825044344.pdf
csedatabasemanagementsystemppt-170825044344.pdf
SameerKhanPathan7
 
Sql basics
Sql  basicsSql  basics
Sql basics
Genesis Omo
 
sql.pdf
sql.pdfsql.pdf
sql.pdf
AnithaIlango
 
Bank mangement system
Bank mangement systemBank mangement system
Bank mangement system
FaisalGhffar
 
MongoDB Knowledge share
MongoDB Knowledge shareMongoDB Knowledge share
MongoDB Knowledge share
Mr Kyaing
 
Databases
DatabasesDatabases

Similar to PHP - Getting good with MySQL part I (20)

Oracle SQL Part1
Oracle SQL Part1Oracle SQL Part1
Oracle SQL Part1
 
sql_data.pdf
sql_data.pdfsql_data.pdf
sql_data.pdf
 
7. SQL.pptx
7. SQL.pptx7. SQL.pptx
7. SQL.pptx
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
LECTURE NOTES.pdf
LECTURE NOTES.pdfLECTURE NOTES.pdf
LECTURE NOTES.pdf
 
Introduction to Oracle
Introduction to OracleIntroduction to Oracle
Introduction to Oracle
 
Introduction to Oracle
Introduction to OracleIntroduction to Oracle
Introduction to Oracle
 
Intro
IntroIntro
Intro
 
MIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresMIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome Measures
 
MS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsMS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutions
 
DATABASE LANGUAGES; DDL, DML, TCL, ETC..
DATABASE LANGUAGES; DDL, DML, TCL, ETC..DATABASE LANGUAGES; DDL, DML, TCL, ETC..
DATABASE LANGUAGES; DDL, DML, TCL, ETC..
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
Database Management System ppt
Database Management System pptDatabase Management System ppt
Database Management System ppt
 
csedatabasemanagementsystemppt-170825044344.pdf
csedatabasemanagementsystemppt-170825044344.pdfcsedatabasemanagementsystemppt-170825044344.pdf
csedatabasemanagementsystemppt-170825044344.pdf
 
Sql basics
Sql  basicsSql  basics
Sql basics
 
sql.pdf
sql.pdfsql.pdf
sql.pdf
 
Bank mangement system
Bank mangement systemBank mangement system
Bank mangement system
 
MongoDB Knowledge share
MongoDB Knowledge shareMongoDB Knowledge share
MongoDB Knowledge share
 
Databases
DatabasesDatabases
Databases
 

More from Firdaus Adib

Rule Based Architecture System
Rule Based Architecture SystemRule Based Architecture System
Rule Based Architecture System
Firdaus Adib
 
Wireless Technology Proj spec
Wireless Technology Proj spec Wireless Technology Proj spec
Wireless Technology Proj spec
Firdaus Adib
 
Corporate Ethics January 2010
Corporate Ethics January 2010Corporate Ethics January 2010
Corporate Ethics January 2010
Firdaus Adib
 
Corporate Ethics July 2008
Corporate Ethics July 2008Corporate Ethics July 2008
Corporate Ethics July 2008
Firdaus Adib
 
Final Paper UTP Web Development Application July 2008
Final Paper UTP Web Development Application July 2008Final Paper UTP Web Development Application July 2008
Final Paper UTP Web Development Application July 2008
Firdaus Adib
 
Final Paper UTP Algorithm Data Structure July 2008
Final Paper UTP Algorithm Data Structure July 2008Final Paper UTP Algorithm Data Structure July 2008
Final Paper UTP Algorithm Data Structure July 2008
Firdaus Adib
 
Final Paper UTP Web Development Application January 2010
Final Paper UTP Web Development Application January 2010Final Paper UTP Web Development Application January 2010
Final Paper UTP Web Development Application January 2010
Firdaus Adib
 
Final Paper UTP Algorithm Data Structure January 2010
Final Paper UTP Algorithm Data Structure January 2010Final Paper UTP Algorithm Data Structure January 2010
Final Paper UTP Algorithm Data Structure January 2010Firdaus Adib
 
Final Paper UTP Web Development Application July 2009
Final Paper UTP Web Development Application July 2009Final Paper UTP Web Development Application July 2009
Final Paper UTP Web Development Application July 2009
Firdaus Adib
 
PHP - Getting good with MySQL part II
 PHP - Getting good with MySQL part II PHP - Getting good with MySQL part II
PHP - Getting good with MySQL part II
Firdaus Adib
 
Php - Getting good with session
Php - Getting good with sessionPhp - Getting good with session
Php - Getting good with session
Firdaus Adib
 
PHP - Getting good with cookies
PHP - Getting good with cookiesPHP - Getting good with cookies
PHP - Getting good with cookies
Firdaus Adib
 
Javascript - Getting Good with Object
Javascript - Getting Good with ObjectJavascript - Getting Good with Object
Javascript - Getting Good with Object
Firdaus Adib
 
Javascript - Getting Good with Loop and Array
Javascript - Getting Good with Loop and ArrayJavascript - Getting Good with Loop and Array
Javascript - Getting Good with Loop and Array
Firdaus Adib
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Firdaus Adib
 
Additional exercise for apa references
Additional exercise for apa referencesAdditional exercise for apa references
Additional exercise for apa references
Firdaus Adib
 
Chapter 2 summarising
Chapter 2 summarisingChapter 2 summarising
Chapter 2 summarising
Firdaus Adib
 
American psychological association (apa)
American psychological association (apa)American psychological association (apa)
American psychological association (apa)
Firdaus Adib
 
Referencing and Citing
Referencing and CitingReferencing and Citing
Referencing and Citing
Firdaus Adib
 
Chapter 2 paraphrasing
Chapter 2 paraphrasingChapter 2 paraphrasing
Chapter 2 paraphrasing
Firdaus Adib
 

More from Firdaus Adib (20)

Rule Based Architecture System
Rule Based Architecture SystemRule Based Architecture System
Rule Based Architecture System
 
Wireless Technology Proj spec
Wireless Technology Proj spec Wireless Technology Proj spec
Wireless Technology Proj spec
 
Corporate Ethics January 2010
Corporate Ethics January 2010Corporate Ethics January 2010
Corporate Ethics January 2010
 
Corporate Ethics July 2008
Corporate Ethics July 2008Corporate Ethics July 2008
Corporate Ethics July 2008
 
Final Paper UTP Web Development Application July 2008
Final Paper UTP Web Development Application July 2008Final Paper UTP Web Development Application July 2008
Final Paper UTP Web Development Application July 2008
 
Final Paper UTP Algorithm Data Structure July 2008
Final Paper UTP Algorithm Data Structure July 2008Final Paper UTP Algorithm Data Structure July 2008
Final Paper UTP Algorithm Data Structure July 2008
 
Final Paper UTP Web Development Application January 2010
Final Paper UTP Web Development Application January 2010Final Paper UTP Web Development Application January 2010
Final Paper UTP Web Development Application January 2010
 
Final Paper UTP Algorithm Data Structure January 2010
Final Paper UTP Algorithm Data Structure January 2010Final Paper UTP Algorithm Data Structure January 2010
Final Paper UTP Algorithm Data Structure January 2010
 
Final Paper UTP Web Development Application July 2009
Final Paper UTP Web Development Application July 2009Final Paper UTP Web Development Application July 2009
Final Paper UTP Web Development Application July 2009
 
PHP - Getting good with MySQL part II
 PHP - Getting good with MySQL part II PHP - Getting good with MySQL part II
PHP - Getting good with MySQL part II
 
Php - Getting good with session
Php - Getting good with sessionPhp - Getting good with session
Php - Getting good with session
 
PHP - Getting good with cookies
PHP - Getting good with cookiesPHP - Getting good with cookies
PHP - Getting good with cookies
 
Javascript - Getting Good with Object
Javascript - Getting Good with ObjectJavascript - Getting Good with Object
Javascript - Getting Good with Object
 
Javascript - Getting Good with Loop and Array
Javascript - Getting Good with Loop and ArrayJavascript - Getting Good with Loop and Array
Javascript - Getting Good with Loop and Array
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Additional exercise for apa references
Additional exercise for apa referencesAdditional exercise for apa references
Additional exercise for apa references
 
Chapter 2 summarising
Chapter 2 summarisingChapter 2 summarising
Chapter 2 summarising
 
American psychological association (apa)
American psychological association (apa)American psychological association (apa)
American psychological association (apa)
 
Referencing and Citing
Referencing and CitingReferencing and Citing
Referencing and Citing
 
Chapter 2 paraphrasing
Chapter 2 paraphrasingChapter 2 paraphrasing
Chapter 2 paraphrasing
 

Recently uploaded

REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Vivekanand Anglo Vedic Academy
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 

Recently uploaded (20)

REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 

PHP - Getting good with MySQL part I

  • 2. 2 Objectives To understand the relational database model. queries database using SQL (Structured Query Language). To understand the MySQL database server. To learn various database interfaces.
  • 3. 3 Introduction Database  An integrated collection of data Database Management System (DBMS)  Provides mechanism for storing and organizing data in a manner that is consistent with the database’s format. The most popular database systems are relational database  Use a language called SQL (Structured Query Language)
  • 4. 4 Introduction Popular database systems  Microsoft SQL Server, OracleTM , SybaseTM InformixTM andMySQLTM. An interface  Software that facilitates communication between a database management system and a program.  Examples: Perl DBI for Perl, DB-API for Python and dbx module for PHP.
  • 5. 5 Relational Database Model A logical presentation of data. Allows relationships among items of the data. Does not concern about the physical structure of the data. Is composed of tables  Tables are composed of rows and columns  Has primary key for referencing data
  • 6. 6 Relational Database Model Database Student_Record Table : Student_Details Table : Score Table : Medical Table : Activities
  • 7. 7 Relational Database Model stud_ID stud_name age cgpa 1111 Lily 19 3.40 2222 Kim 18 2.75 3333 Ali 21 3.00 Database Name: Student_Record Table Name: Score Primary key A major strength of the relational model: supports simple, powerful querying of data.
  • 8. 8 SQL (Structured Query Language) Developed by IBM in the 1970s. Two Categories of SQL Statement. 1. Data manipulation • SELECT, INSERT, DELETE 2. Data definition • CREATE DATABASE, DROP DATABASE • CREATE TABLE, DROP TABLE
  • 9. 9 Basic SELECT Query SELECT column_name FROM table_name WHERE condition; Select all columns from a table  SELECT * FROM table_name  SELECT * FROM Score Select specific column(s) from a table  SELECT student_name FROM Score  SELECT student_name, age FROM Score
  • 10. 10 Basic SELECT Query Specify the selection criteria for the query.  SELECT student_id, cgpa FROM Score WHERE age > 18; Use pattern matching to search for similar strings  SELECT student_id, cgpa FROM Score WHERE student_name LIKE ‘K*’;
  • 11. 11 Basic SELECT Query Use pattern matching to search for strings in which exactly ONE character takes the selected character(?) place  SELECT student_id, cgpa FROM Score WHERE student_name LIKE ‘?i*’; 2nd letter Arrange in ascending or descending order  SELECT column_name1, column_name2,… FROM table_name ORDER BY column_name ASC;
  • 12. 12 Basic SELECT Query Arrange in ascending or descending order  SELECT column_name1, column_name2,… FROM table_name ORDER BY column_name DESC;  SELECT student_ID, student_name, cgpa FROM Score ORDER BY student_name DESC;
  • 13. 13 Basic SELECT Query Arrange rows in ascending order by multiple columns  SELECT column_name1, column_name2,... FROM table_name ORDER BY column_name1 SortingOrder1, column_name2 SortingOrder2,... ;  SELECT student_ID, student_name, cgpa FROM Score ORDER BY student_name, age
  • 14. 14 Use SELECT to join tables Use an INNER JOIN to merge rows from two or more tables by testing for matching values.  SELECT column_name1, column_name2,... FROM table_name1 INNER JOIN table_name2 ON table_name1.column_name = table_name2.column_name;
  • 15. 15 Use SELECT to join tables  SELECT student_name, blood_group,... FROM Score INNER JOIN Medical ON Score.student_ID = Medical.student_ID ORDER BY student_name; The query combines the student_name and cgpa columns from table Score and column blood_group from table Medical, sorting the result in ascending order by student_name
  • 16. 16 Use SELECT to join tables SELECT table_name1.colx, table_name2.coly... FROM table_name1, table_name2 WHERE condition; SELECT Score.student_name, Score.cgpa, Medical.blood_group FROM Score, Medical WHERE Score.student_ID = Medical.student_ID;
  • 17. 17 SQL Statement: INSERT INSERT INTO table_name (col1, col2, col3, ...) VALUES (‘text1’,’text2’...,num1,…); INSERT INTO Score (student_id, cgpa) VALUES(4444, 3.5); INSERT INTO Score VALUES(4444,’John’,19,3.5);
  • 18. 18 SQL Statement: DELETE DELETE FROM table_name WHERE condition;  DELETE FROM Score WHERE student_name=‘Lily’;
  • 19. 19 SQL Statement: UPDATE UPDATE table_name SET column_name1 = value1, column_name2 = value2, … WHERE criteria; UPDATE Score SET student_name = ‘Kimchi’, age = 20, WHERE student_ID = 3333;
  • 20. 20 MySQL Multiuser, multithreaded RDBMS server Uses SQL to interact with and manipulate data Few important features  Enable multiple tasks concurrently – requesting process is more efficient  Support various programming language  Available for all common platforms  Full support of functions and operators to manipulate data  Accessing tables from different database using a single query  Able to handle large database
  • 23. TAB1033 - Internet Programming 23 Create Table fields
  • 24. TAB1033 - Internet Programming 24 Table in MySQL
  • 25. 25 Introduction to Database Interface Perl Database Interface (DBI)  Enables user to access relational database from Perl program.  Database independent – allows migration among DBMS  Uses object-oriented interface – handles PHP dbx module  An XHTML-embedded scripting language  Database interface that does not interact with database directly  It interacts with one of several database-specific module
  • 26. 26 Introduction to DBI Phyton DB-API  Database Application Programming Interface  Consists of :  Connection data object – access the database  Cursor data object – manipulate and retrieve data  Portable across several databases
  • 27. 27 ADO.NET Object Model Provides an API for accessing database systems programmatically. Was created for .NET framework Was designed to interact with Microsoft’s Component Object ModelTM (COM) framework. Further reading : Textbook, page 736
  • 28. 28 Summary What is database? The most popular database – relational database SQL for database queries Database consists table(s) Two Categories of SQL Statement. 1. Data manipulation • SELECT, INSERT, DELETE,UPDATE 2. Data definition DBI – Perl DBI, PHP dbx module, Python DB- API ADO.NET object Model