SlideShare ist ein Scribd-Unternehmen logo
1 von 50
Web
+ Database
Useful
Web Apps
CGS 2835

Interdisciplinary Web Development
The Value of Databases
• Databases and Database Management Systems (DBMS)
transform large quantities of data into specific and
valuable information for accomplishing some goal.

CGS 2835

Interdisciplinary Web Development
AMP
Today’s Dominant Web Architecture

• Apache – open source Web server
• MySQL – open source database
• PHP – programming language that
works in HTML to provide
interactivity with MySQL

CGS 2835

Interdisciplinary Web Development
AMP
Today’s Dominant Web Architecture

•
•
•
•
•

LAMP (Linux AMP)
SAMP (Solaris AMP)
WAMP (Windows AMP)
MAMP (Mac AMP)
XAMPP (Cross Platform AMP + Perl)

CGS 2835

Interdisciplinary Web Development
http://iSpace.ci.fsu.edu/~username/mysite/index.html?name=geo

HTML REQUEST w/DATA
HTML REQUEST w/DATA

Web
Server

PHP
Database
Server

CGS 2835

SQL Command
SQL Command

Interdisciplinary Web Development
PHP-created HTML

Web
Server

PHP
Database
Server

CGS 2835

data

Interdisciplinary Web Development
Our Focus
PHP-created HTML
MySQL
Database
Server

CGS 2835

SQL
SQL

data

PHP

Interdisciplinary Web Development
Databases

CGS 2835

Interdisciplinary Web Development
Database

• A collection of data organized to meet user’s
needs.
File or Table
Field
(Attribute)

Records
(Entities)

CGS 2835

Interdisciplinary Web Development
Database Fields
• Fields are set to hold
specific types of data.

CGS 2835

Interdisciplinary Web Development
Database

A Database
is a
collection of
files/tables

CGS 2835

Interdisciplinary Web Development
Database Heirarchy

Table

CGS 2835

Interdisciplinary Web Development
Keys and Primary Key
• Key: A field in a record that is used to identify
the record
• Primary key: A field that uniquely identifies a
record
– A primary key field prevents duplicate records
from occurring in a table.

CGS 2835

Interdisciplinary Web Development
Primary Keys

Which field would act as the best
primary key?

CGS 2835

Interdisciplinary Web Development
Primary Key

CGS 2835

Interdisciplinary Web Development
The Relational Model
• In a relational database, tables are linked (related) through
common fields.

CGS 2835

Interdisciplinary Web Development
Relation Types
• One-to-many

– Most typical
– Makes use of primary key

• One-to-one
• Many-to-many

CGS 2835

Interdisciplinary Web Development
MySQL
An open-source, relational database
ideal for use with PHP

CGS 2835

Interdisciplinary Web Development
MySQL - Installation
• MySQL is included with AMP
• and installed on iSpace
http://localhost

CGS 2835

Interdisciplinary Web Development

http://tools.ci.fsu.edu
MySQL – Creating a Database
• For security reasons MySQL accounts are
created through MySQL Administrative Tools
• Creating a MySQL account is the only
database command that cannot be issued
from PHP code.

CGS 2835

Interdisciplinary Web Development
MySQL – Creating a Database
https://ispace-tools.cci.fsu.edu

CGS 2835

Interdisciplinary Web Development
You will need this
You will need this
information for
information for
use in your PHP
use in your PHP
Code
Code

Click Edit to manage the database
Click Edit to manage the database
with phpMyAdmin
with phpMyAdmin

CGS 2835

Interdisciplinary Web Development
phpMyAdmin
is a popular application
for managing mySQL
databases. It’s provided
at tools.ci.fsu.edu and
also often included with
AMP.
Here you can click a
database name to access
its properties and tools.
You can even create new
databases from here.
Note that whenever
prompted for charset or
collation select UTF-8
Unicode (utf8).

CGS 2835

Interdisciplinary Web Development
Access MySQL Database
We will use phpMyAdmin
to:

We will use PHP to:

•Create our databases
•Create tables in the databases
•Create fields in the tables
•Manage the database
•Examine table data

• Enter records into tables
from HTML forms
• Read records from tables
and output to HTML pages

CGS 2835

Interdisciplinary Web Development
When I click my database link in phpMyAdmin, I am prompted to create a table.

CGS 2835

Interdisciplinary Web Development
Then I create fields for my table.

CGS 2835

Interdisciplinary Web Development
I can then use the
Insert tab to enter
records into the table.

CGS 2835

Interdisciplinary Web Development
CGS 2835

Interdisciplinary Web Development
The browse buttons allows you to view the contents of the table.

CGS 2835

Interdisciplinary Web Development
CGS 2835

Interdisciplinary Web Development
You can also run SQL
queries on your data from
within phpMyAdmin.

CGS 2835

Interdisciplinary Web Development
MySQL & phpMyAdmin
• phpMyAdmin is a useful tool for manipulating mySQL
databases; however, in order to work with Web-generated
data, the mySQL database must be accessed from the HTML
code using PHP.

MySQL
Database
Server

SQL
SQL

CGS 2835

SQL
SQL

Interdisciplinary Web Development

PHP
MySQL & phpMyAdmin
• Either method of interacting with the database
requires knowledge of SQL
MySQL
Database
Server

SQL
SQL

CGS 2835

SQL
SQL

Interdisciplinary Web Development

PHP
SQL – The Basics

CGS 2835

Interdisciplinary Web Development
Database Strengths
 The power of a database and DBMS lies in the
user’s ability to manipulate the data to turn up
useful information.
• Data can be sifted, sorted
and queried through the
use of data manipulation
languages.

CGS 2835

Interdisciplinary Web Development
Data Manipulation Language
• A Data Manipulation Language (DML) is a specific
language provided with the DBMS that allows people
and other database users to access, modify, and
make queries about data contained in the database,
and to generate reports.
• Structured Query Language (SQL): The most popular
DML.
– SELECT * FROM EMPLOYEE WHERE JOB_CLASSIFICATION = ‘C2”

CGS 2835

Interdisciplinary Web Development
SQL Commands
SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index
From www.w3schools.com/sql

CGS 2835

Interdisciplinary Web Development
Employees Table

SELECT
SELECT field_names(s)
FROM table_name

Employee_Id LastName
1 Baldauf
2 Svendson
3 Pettersen
4 Willis
5 Smith

FirstName
Ola
Jon
Kari
Carl
Jason

Address
120 Main St
3 Bogus Dr
2413 Sayer Ave
12 Bacon Cr

Examples:
SELECT LastName,FirstName FROM Employees
LastName
Baldauf
Svendson
Pettersen
Willis
Smith

SELECT * FROM Employees
Employee_Id LastName
1 Baldauf
2 Svendson
3 Pettersen
4 Willis
5 Smith

CGS 2835

FirstName
Ola
Jon
Kari
Carl
Jason

FirstName
Ola
Jon
Kari

Address
120 Main St
3 Bogus Dr
2413 Sayer Ave

City
Chicago
Tallahassee
Tallahassee

Carl
Jason

12 Bacon Cr

Atlanta

Interdisciplinary Web Development

City
Chicago
Tallahassee
Tallahassee
Atlanta
Employees Table

SELECT

Employee_Id LastName
1 Baldauf
2 Svendson
3 Pettersen
4 Willis
5 Smith

SELECT column_name(s)
FROM table_name
WHERE column_name operator value

FirstName
Ola
Jon
Kari
Carl
Jason

Address
120 Main St
3 Bogus Dr
2413 Sayer Ave
12 Bacon Cr

Example
SELECT * FROM Employees WHERE LastName=’Willis'
Employee_Id LastName
4 Willis

CGS 2835

FirstName
Carl

Address
12 Bacon Cr

City
Atlanta

Interdisciplinary Web Development

City
Chicago
Tallahassee
Tallahassee
Atlanta
SELECT

Employees Table
Employee_Id LastName
1 Baldauf
2 Svendson
3 Pettersen
4 Willis
5 Smith

FirstName
Ola
Jon
Kari
Carl
Jason

Address
120 Main St
3 Bogus Dr
2413 Sayer Ave
12 Bacon Cr

SELECT column_name(s)
FROM table_name
WHERE column_name operator value
AND/OR column_name operator value
Example
SELECT * FROM Employees WHERE LastName=’Willis’ OR
LastName=‘Pettersen’
Employee_Id LastName
3 Pettersen
4 Willis

CGS 2835

FirstName
Kari
Carl

Address
City
2413 Sayer Ave Tallahassee
12 Bacon Cr
Atlanta

Interdisciplinary Web Development

City
Chicago
Tallahassee
Tallahassee
Atlanta
UPDATE

Employees Table
Employee_Id LastName
1 Baldauf
2 Svendson
3 Pettersen
4 Willis
5 Smith

FirstName
Ola
Jon
Kari
Carl
Jason

Address
120 Main St
3 Bogus Dr
2413 Sayer Ave
12 Bacon Cr

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
Example
UPDATE Employees
SET Address=’2727 Monroe St', City=’Tallahassee'
WHERE LastName=’Smith' AND FirstName=’Jason'
Employee_Id LastName
1 Baldauf
2 Svendson
3 Pettersen
4 Willis
5 Smith

CGS 2835

FirstName
Ola

Address
120 Main St

City
Chicago

Jon
Kari
Carl
Jason

3 Bogus Dr
2413 Sayer Ave
12 Bacon Cr
2727 Monroe St

Tallahassee
Tallahassee
Atlanta
Tallahassee

Interdisciplinary Web Development

City
Chicago
Tallahassee
Tallahassee
Atlanta
INSERT INTO

Employees Table
Employee_Id LastName
1 Baldauf
2 Svendson
3 Pettersen
4 Willis
5 Smith

FirstName
Ola
Jon
Kari
Carl
Jason

Address
120 Main St
3 Bogus Dr
2413 Sayer Ave
12 Bacon Cr

City
Chicago
Tallahassee
Tallahassee
Atlanta

INSERT INTO table_name
(ColumnName1, … , ColumnNameN )
VALUES (‘data1’, … , ‘dataN’)
Example
INSERT INTO Employees (LastName, FirstName, Address, City)
VALUES (‘Larkin’, ‘Robert’, ‘34 W 7th’, ‘Atlanta’)
Employee_Id LastName
1 Baldauf
2 Svendson
3 Pettersen
4 Willis
5 Smith
6 Larkin

CGS 2835

FirstName
Ola
Jon
Kari

Address
120 Main St
3 Bogus Dr
2413 Sayer Ave

City
Chicago
Tallahassee
Tallahassee

Carl
Jason
Robert

12 Bacon Cr

Atlanta

34 W 7th

Atlanta

Interdisciplinary Web Development
DELETE

Employees Table
Employee_Id LastName
1 Baldauf
2 Svendson
3 Pettersen
4 Willis
5 Smith

FirstName
Ola
Jon
Kari
Carl
Jason

DELETE FROM table_name
WHERE some_column=some_value
Example
DELETE FROM Employees
WHERE LastName=’Willis' AND FirstName=’Carl'
Employee_Id LastName
1 Baldauf
2 Svendson
3 Pettersen
5 Smith

CGS 2835

Address
120 Main St
3 Bogus Dr
2413 Sayer Ave
12 Bacon Cr

FirstName
Ola

Address
120 Main St

Jon
Kari
Jason

3 Bogus Dr
Tallahassee
2413 Sayer Ave Tallahassee
2727 Monroe St Tallahassee

Interdisciplinary Web Development

City
Chicago

City
Chicago
Tallahassee
Tallahassee
Atlanta
PHP > MySQL

CGS 2835

Interdisciplinary Web Development
Accessing a MySQL Database from PHP
First create a database, table, and fields using phpMyAdmin

1.Establish a connection to mySQL server
2.Select the database
3.Use mysql_query to issue SQL commands

CGS 2835

Interdisciplinary Web Development
1. Establish a Connection
mysql_connect("2006.ispace.ci.fsu.edu", ”glm04", ”tm4bj9yc") or die(mysql_error());

CGS 2835

Interdisciplinary Web Development
2. Select the Database
mysql_connect("2006.ispace.ci.fsu.edu", ”glm04", ”tm4bj9yc") or die(mysql_error());

mysql_select_db(’glm04_webdev') or die(mysql_error());

CGS 2835

Interdisciplinary Web Development
3. Use mysql_query
to Issue Commands
mysql_connect("2006.ispace.ci.fsu.edu", ”glm04", ”tm4bj9yc") or die(mysql_error());

mysql_select_db(’glm04_webdev') or die(mysql_error());
mysql_query("INSERT INTO visitors
(name, email) VALUES('Timmy Mellowman', 'mellowman@fsu.edu' ) ")
or die(mysql_error());

CGS 2835

Interdisciplinary Web Development
3. Use mysql_query
to Issue Commands
mysql_connect("2006.ispace.ci.fsu.edu", ”glm04", ”tm4bj9yc") or die(mysql_error());

mysql_select_db(’glm04_webdev') or die(mysql_error());
$result = mysql_query("SELECT * FROM visitors")
or die(mysql_error());
while($row = mysql_fetch_array( $result )){
echo ”<p> Name: ".$row['name'] ."<br />";
echo "Email: ".$row['email'] ."<br />";
echo " Date: ".$row['date'] .”</p>";
}

CGS 2835

Interdisciplinary Web Development
Useful Resources
• Tizag PHP/MySQL Tutorial
– http://www.tizag.com/mysqlTutorial

• W3Schools
– PHP MySQL: http://www.w3schools.com/php/php_mysql_intro.asp
– SQL: http://www.w3schools.com/sql/default.asp

• MySQL Manual:
– http://dev.mysql.com/doc/refman/5.0/en

• PHP MySQL functions:
– http://us3.php.net/manual/en/ref.mysql.php

CGS 2835

Interdisciplinary Web Development

Weitere ähnliche Inhalte

Was ist angesagt?

Azure Databricks is Easier Than You Think
Azure Databricks is Easier Than You ThinkAzure Databricks is Easier Than You Think
Azure Databricks is Easier Than You ThinkIke Ellis
 
Business Intelligence with SQL Server
Business Intelligence with SQL ServerBusiness Intelligence with SQL Server
Business Intelligence with SQL ServerPeter Gfader
 
What's new in SQL Server 2016
What's new in SQL Server 2016What's new in SQL Server 2016
What's new in SQL Server 2016James Serra
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databasesJames Serra
 
SharePoint Databases: What you need to know (201504)
SharePoint Databases: What you need to know (201504)SharePoint Databases: What you need to know (201504)
SharePoint Databases: What you need to know (201504)Alan Eardley
 
Turbo Enterprise Web 2.0 Ajax World 20081
Turbo Enterprise Web 2.0 Ajax World 20081Turbo Enterprise Web 2.0 Ajax World 20081
Turbo Enterprise Web 2.0 Ajax World 20081rajivmordani
 
Hi! Ho! Hi! Ho! SQL Server on Linux We Go!
Hi! Ho! Hi! Ho! SQL Server on Linux We Go!Hi! Ho! Hi! Ho! SQL Server on Linux We Go!
Hi! Ho! Hi! Ho! SQL Server on Linux We Go!SolarWinds
 
Big Data for Oracle Devs - Towards Spark, Real-Time and Predictive Analytics
Big Data for Oracle Devs - Towards Spark, Real-Time and Predictive AnalyticsBig Data for Oracle Devs - Towards Spark, Real-Time and Predictive Analytics
Big Data for Oracle Devs - Towards Spark, Real-Time and Predictive AnalyticsMark Rittman
 
Microsoft SQL Server internals & architecture
Microsoft SQL Server internals & architectureMicrosoft SQL Server internals & architecture
Microsoft SQL Server internals & architectureKevin Kline
 
Big Data: InterConnect 2016 Session on Getting Started with Big Data Analytics
Big Data:  InterConnect 2016 Session on Getting Started with Big Data AnalyticsBig Data:  InterConnect 2016 Session on Getting Started with Big Data Analytics
Big Data: InterConnect 2016 Session on Getting Started with Big Data AnalyticsCynthia Saracco
 
Fard Solutions Sdn Bhd
Fard Solutions Sdn Bhd Fard Solutions Sdn Bhd
Fard Solutions Sdn Bhd Hamid J. Fard
 
Hadoop-DS: Which SQL-on-Hadoop Rules the Herd
Hadoop-DS: Which SQL-on-Hadoop Rules the HerdHadoop-DS: Which SQL-on-Hadoop Rules the Herd
Hadoop-DS: Which SQL-on-Hadoop Rules the HerdIBM Analytics
 
Big SQL 3.0 - Fast and easy SQL on Hadoop
Big SQL 3.0 - Fast and easy SQL on HadoopBig SQL 3.0 - Fast and easy SQL on Hadoop
Big SQL 3.0 - Fast and easy SQL on HadoopWilfried Hoge
 
Big SQL 3.0 - Toronto Meetup -- May 2014
Big SQL 3.0 - Toronto Meetup -- May 2014Big SQL 3.0 - Toronto Meetup -- May 2014
Big SQL 3.0 - Toronto Meetup -- May 2014Nicolas Morales
 
Big Data: Working with Big SQL data from Spark
Big Data:  Working with Big SQL data from Spark Big Data:  Working with Big SQL data from Spark
Big Data: Working with Big SQL data from Spark Cynthia Saracco
 
Hadoop Innovation Summit 2014
Hadoop Innovation Summit 2014Hadoop Innovation Summit 2014
Hadoop Innovation Summit 2014Data Con LA
 
What's new in SQL Server 2016
What's new in SQL Server 2016What's new in SQL Server 2016
What's new in SQL Server 2016Onomi
 
Meetup Oracle Database MAD_BCN: 1.2 Oracle Database 18c (autonomous database)
Meetup Oracle Database MAD_BCN: 1.2 Oracle Database 18c (autonomous database)Meetup Oracle Database MAD_BCN: 1.2 Oracle Database 18c (autonomous database)
Meetup Oracle Database MAD_BCN: 1.2 Oracle Database 18c (autonomous database)avanttic ConsultorĂ­a TecnolĂłgica
 

Was ist angesagt? (19)

Azure Databricks is Easier Than You Think
Azure Databricks is Easier Than You ThinkAzure Databricks is Easier Than You Think
Azure Databricks is Easier Than You Think
 
Business Intelligence with SQL Server
Business Intelligence with SQL ServerBusiness Intelligence with SQL Server
Business Intelligence with SQL Server
 
What's new in SQL Server 2016
What's new in SQL Server 2016What's new in SQL Server 2016
What's new in SQL Server 2016
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databases
 
SharePoint Databases: What you need to know (201504)
SharePoint Databases: What you need to know (201504)SharePoint Databases: What you need to know (201504)
SharePoint Databases: What you need to know (201504)
 
Turbo Enterprise Web 2.0 Ajax World 20081
Turbo Enterprise Web 2.0 Ajax World 20081Turbo Enterprise Web 2.0 Ajax World 20081
Turbo Enterprise Web 2.0 Ajax World 20081
 
Hi! Ho! Hi! Ho! SQL Server on Linux We Go!
Hi! Ho! Hi! Ho! SQL Server on Linux We Go!Hi! Ho! Hi! Ho! SQL Server on Linux We Go!
Hi! Ho! Hi! Ho! SQL Server on Linux We Go!
 
Big Data for Oracle Devs - Towards Spark, Real-Time and Predictive Analytics
Big Data for Oracle Devs - Towards Spark, Real-Time and Predictive AnalyticsBig Data for Oracle Devs - Towards Spark, Real-Time and Predictive Analytics
Big Data for Oracle Devs - Towards Spark, Real-Time and Predictive Analytics
 
Diving into sql server 2016
Diving into sql server 2016Diving into sql server 2016
Diving into sql server 2016
 
Microsoft SQL Server internals & architecture
Microsoft SQL Server internals & architectureMicrosoft SQL Server internals & architecture
Microsoft SQL Server internals & architecture
 
Big Data: InterConnect 2016 Session on Getting Started with Big Data Analytics
Big Data:  InterConnect 2016 Session on Getting Started with Big Data AnalyticsBig Data:  InterConnect 2016 Session on Getting Started with Big Data Analytics
Big Data: InterConnect 2016 Session on Getting Started with Big Data Analytics
 
Fard Solutions Sdn Bhd
Fard Solutions Sdn Bhd Fard Solutions Sdn Bhd
Fard Solutions Sdn Bhd
 
Hadoop-DS: Which SQL-on-Hadoop Rules the Herd
Hadoop-DS: Which SQL-on-Hadoop Rules the HerdHadoop-DS: Which SQL-on-Hadoop Rules the Herd
Hadoop-DS: Which SQL-on-Hadoop Rules the Herd
 
Big SQL 3.0 - Fast and easy SQL on Hadoop
Big SQL 3.0 - Fast and easy SQL on HadoopBig SQL 3.0 - Fast and easy SQL on Hadoop
Big SQL 3.0 - Fast and easy SQL on Hadoop
 
Big SQL 3.0 - Toronto Meetup -- May 2014
Big SQL 3.0 - Toronto Meetup -- May 2014Big SQL 3.0 - Toronto Meetup -- May 2014
Big SQL 3.0 - Toronto Meetup -- May 2014
 
Big Data: Working with Big SQL data from Spark
Big Data:  Working with Big SQL data from Spark Big Data:  Working with Big SQL data from Spark
Big Data: Working with Big SQL data from Spark
 
Hadoop Innovation Summit 2014
Hadoop Innovation Summit 2014Hadoop Innovation Summit 2014
Hadoop Innovation Summit 2014
 
What's new in SQL Server 2016
What's new in SQL Server 2016What's new in SQL Server 2016
What's new in SQL Server 2016
 
Meetup Oracle Database MAD_BCN: 1.2 Oracle Database 18c (autonomous database)
Meetup Oracle Database MAD_BCN: 1.2 Oracle Database 18c (autonomous database)Meetup Oracle Database MAD_BCN: 1.2 Oracle Database 18c (autonomous database)
Meetup Oracle Database MAD_BCN: 1.2 Oracle Database 18c (autonomous database)
 

Ähnlich wie Database

A Complete BI Solution in About an Hour!
A Complete BI Solution in About an Hour!A Complete BI Solution in About an Hour!
A Complete BI Solution in About an Hour!Aaron King
 
SQL Analytics Powering Telemetry Analysis at Comcast
SQL Analytics Powering Telemetry Analysis at ComcastSQL Analytics Powering Telemetry Analysis at Comcast
SQL Analytics Powering Telemetry Analysis at ComcastDatabricks
 
(Updated) SharePoint & jQuery Guide
(Updated) SharePoint & jQuery Guide(Updated) SharePoint & jQuery Guide
(Updated) SharePoint & jQuery GuideMark Rackley
 
MySQL Guide for Beginners
MySQL Guide for BeginnersMySQL Guide for Beginners
MySQL Guide for BeginnersDainis Graveris
 
SQL Server 2019 Master Data Service
SQL Server 2019 Master Data ServiceSQL Server 2019 Master Data Service
SQL Server 2019 Master Data ServiceKenichiro Nakamura
 
AZMS PRESENTATION.pptx
AZMS PRESENTATION.pptxAZMS PRESENTATION.pptx
AZMS PRESENTATION.pptxSonuShaw16
 
Migrate SQL Workloads to Azure
Migrate SQL Workloads to AzureMigrate SQL Workloads to Azure
Migrate SQL Workloads to AzureAntonios Chatzipavlis
 
A to z for sql azure databases
A to z for sql azure databasesA to z for sql azure databases
A to z for sql azure databasesAntonios Chatzipavlis
 
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint SecurityAUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint SecurityMichael Noel
 
Azure Data.pptx
Azure Data.pptxAzure Data.pptx
Azure Data.pptxFedoRam1
 
In-memory ColumnStore Index
In-memory ColumnStore IndexIn-memory ColumnStore Index
In-memory ColumnStore IndexSolidQ
 
Unlocking the Value of Your Data Lake
Unlocking the Value of Your Data LakeUnlocking the Value of Your Data Lake
Unlocking the Value of Your Data LakeDATAVERSITY
 
Oracle to Azure PostgreSQL database migration webinar
Oracle to Azure PostgreSQL database migration webinarOracle to Azure PostgreSQL database migration webinar
Oracle to Azure PostgreSQL database migration webinarMinnie Seungmin Cho
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Antonios Chatzipavlis
 
SQL - RDBMS Concepts
SQL - RDBMS ConceptsSQL - RDBMS Concepts
SQL - RDBMS ConceptsWebStackAcademy
 

Ähnlich wie Database (20)

Database basics
Database basicsDatabase basics
Database basics
 
Mysql
MysqlMysql
Mysql
 
A Complete BI Solution in About an Hour!
A Complete BI Solution in About an Hour!A Complete BI Solution in About an Hour!
A Complete BI Solution in About an Hour!
 
SQL Analytics Powering Telemetry Analysis at Comcast
SQL Analytics Powering Telemetry Analysis at ComcastSQL Analytics Powering Telemetry Analysis at Comcast
SQL Analytics Powering Telemetry Analysis at Comcast
 
PHP FUNCTIONS
PHP FUNCTIONSPHP FUNCTIONS
PHP FUNCTIONS
 
(Updated) SharePoint & jQuery Guide
(Updated) SharePoint & jQuery Guide(Updated) SharePoint & jQuery Guide
(Updated) SharePoint & jQuery Guide
 
MySQL Guide for Beginners
MySQL Guide for BeginnersMySQL Guide for Beginners
MySQL Guide for Beginners
 
SQL Server 2019 Master Data Service
SQL Server 2019 Master Data ServiceSQL Server 2019 Master Data Service
SQL Server 2019 Master Data Service
 
Mstr meetup
Mstr meetupMstr meetup
Mstr meetup
 
AZMS PRESENTATION.pptx
AZMS PRESENTATION.pptxAZMS PRESENTATION.pptx
AZMS PRESENTATION.pptx
 
Azure SQL Data Warehouse
Azure SQL Data Warehouse Azure SQL Data Warehouse
Azure SQL Data Warehouse
 
Migrate SQL Workloads to Azure
Migrate SQL Workloads to AzureMigrate SQL Workloads to Azure
Migrate SQL Workloads to Azure
 
A to z for sql azure databases
A to z for sql azure databasesA to z for sql azure databases
A to z for sql azure databases
 
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint SecurityAUSPC 2013 - Understanding the Five Layers of SharePoint Security
AUSPC 2013 - Understanding the Five Layers of SharePoint Security
 
Azure Data.pptx
Azure Data.pptxAzure Data.pptx
Azure Data.pptx
 
In-memory ColumnStore Index
In-memory ColumnStore IndexIn-memory ColumnStore Index
In-memory ColumnStore Index
 
Unlocking the Value of Your Data Lake
Unlocking the Value of Your Data LakeUnlocking the Value of Your Data Lake
Unlocking the Value of Your Data Lake
 
Oracle to Azure PostgreSQL database migration webinar
Oracle to Azure PostgreSQL database migration webinarOracle to Azure PostgreSQL database migration webinar
Oracle to Azure PostgreSQL database migration webinar
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
 
SQL - RDBMS Concepts
SQL - RDBMS ConceptsSQL - RDBMS Concepts
SQL - RDBMS Concepts
 

Mehr von Program in Interdisciplinary Computing (20)

Phpmysqlcoding
PhpmysqlcodingPhpmysqlcoding
Phpmysqlcoding
 
CGS2835 HTML5
CGS2835 HTML5CGS2835 HTML5
CGS2835 HTML5
 
Mysocial databasequeries
Mysocial databasequeriesMysocial databasequeries
Mysocial databasequeries
 
Mysocial databasequeries
Mysocial databasequeriesMysocial databasequeries
Mysocial databasequeries
 
CGS2835 HTML5
CGS2835 HTML5CGS2835 HTML5
CGS2835 HTML5
 
01 intro tousingjava
01 intro tousingjava01 intro tousingjava
01 intro tousingjava
 
Web architecture v3
Web architecture v3Web architecture v3
Web architecture v3
 
Xhtml
XhtmlXhtml
Xhtml
 
Webdev
WebdevWebdev
Webdev
 
Web architecture
Web architectureWeb architecture
Web architecture
 
Sdlc
SdlcSdlc
Sdlc
 
Mysocial
MysocialMysocial
Mysocial
 
Javascript
JavascriptJavascript
Javascript
 
Javascript
JavascriptJavascript
Javascript
 
Html5
Html5Html5
Html5
 
Frameworks
FrameworksFrameworks
Frameworks
 
Drupal
DrupalDrupal
Drupal
 
Javascript2
Javascript2Javascript2
Javascript2
 
12 abstract classes
12 abstract classes12 abstract classes
12 abstract classes
 
11 polymorphism
11 polymorphism11 polymorphism
11 polymorphism
 

KĂźrzlich hochgeladen

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂşjo
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

KĂźrzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Database

  • 1. Web + Database Useful Web Apps CGS 2835 Interdisciplinary Web Development
  • 2. The Value of Databases • Databases and Database Management Systems (DBMS) transform large quantities of data into specific and valuable information for accomplishing some goal. CGS 2835 Interdisciplinary Web Development
  • 3. AMP Today’s Dominant Web Architecture • Apache – open source Web server • MySQL – open source database • PHP – programming language that works in HTML to provide interactivity with MySQL CGS 2835 Interdisciplinary Web Development
  • 4. AMP Today’s Dominant Web Architecture • • • • • LAMP (Linux AMP) SAMP (Solaris AMP) WAMP (Windows AMP) MAMP (Mac AMP) XAMPP (Cross Platform AMP + Perl) CGS 2835 Interdisciplinary Web Development
  • 5. http://iSpace.ci.fsu.edu/~username/mysite/index.html?name=geo HTML REQUEST w/DATA HTML REQUEST w/DATA Web Server PHP Database Server CGS 2835 SQL Command SQL Command Interdisciplinary Web Development
  • 7. Our Focus PHP-created HTML MySQL Database Server CGS 2835 SQL SQL data PHP Interdisciplinary Web Development
  • 9. Database • A collection of data organized to meet user’s needs. File or Table Field (Attribute) Records (Entities) CGS 2835 Interdisciplinary Web Development
  • 10. Database Fields • Fields are set to hold specific types of data. CGS 2835 Interdisciplinary Web Development
  • 11. Database A Database is a collection of files/tables CGS 2835 Interdisciplinary Web Development
  • 13. Keys and Primary Key • Key: A field in a record that is used to identify the record • Primary key: A field that uniquely identifies a record – A primary key field prevents duplicate records from occurring in a table. CGS 2835 Interdisciplinary Web Development
  • 14. Primary Keys Which field would act as the best primary key? CGS 2835 Interdisciplinary Web Development
  • 16. The Relational Model • In a relational database, tables are linked (related) through common fields. CGS 2835 Interdisciplinary Web Development
  • 17. Relation Types • One-to-many – Most typical – Makes use of primary key • One-to-one • Many-to-many CGS 2835 Interdisciplinary Web Development
  • 18. MySQL An open-source, relational database ideal for use with PHP CGS 2835 Interdisciplinary Web Development
  • 19. MySQL - Installation • MySQL is included with AMP • and installed on iSpace http://localhost CGS 2835 Interdisciplinary Web Development http://tools.ci.fsu.edu
  • 20. MySQL – Creating a Database • For security reasons MySQL accounts are created through MySQL Administrative Tools • Creating a MySQL account is the only database command that cannot be issued from PHP code. CGS 2835 Interdisciplinary Web Development
  • 21. MySQL – Creating a Database https://ispace-tools.cci.fsu.edu CGS 2835 Interdisciplinary Web Development
  • 22. You will need this You will need this information for information for use in your PHP use in your PHP Code Code Click Edit to manage the database Click Edit to manage the database with phpMyAdmin with phpMyAdmin CGS 2835 Interdisciplinary Web Development
  • 23. phpMyAdmin is a popular application for managing mySQL databases. It’s provided at tools.ci.fsu.edu and also often included with AMP. Here you can click a database name to access its properties and tools. You can even create new databases from here. Note that whenever prompted for charset or collation select UTF-8 Unicode (utf8). CGS 2835 Interdisciplinary Web Development
  • 24. Access MySQL Database We will use phpMyAdmin to: We will use PHP to: •Create our databases •Create tables in the databases •Create fields in the tables •Manage the database •Examine table data • Enter records into tables from HTML forms • Read records from tables and output to HTML pages CGS 2835 Interdisciplinary Web Development
  • 25. When I click my database link in phpMyAdmin, I am prompted to create a table. CGS 2835 Interdisciplinary Web Development
  • 26. Then I create fields for my table. CGS 2835 Interdisciplinary Web Development
  • 27. I can then use the Insert tab to enter records into the table. CGS 2835 Interdisciplinary Web Development
  • 29. The browse buttons allows you to view the contents of the table. CGS 2835 Interdisciplinary Web Development
  • 31. You can also run SQL queries on your data from within phpMyAdmin. CGS 2835 Interdisciplinary Web Development
  • 32. MySQL & phpMyAdmin • phpMyAdmin is a useful tool for manipulating mySQL databases; however, in order to work with Web-generated data, the mySQL database must be accessed from the HTML code using PHP. MySQL Database Server SQL SQL CGS 2835 SQL SQL Interdisciplinary Web Development PHP
  • 33. MySQL & phpMyAdmin • Either method of interacting with the database requires knowledge of SQL MySQL Database Server SQL SQL CGS 2835 SQL SQL Interdisciplinary Web Development PHP
  • 34. SQL – The Basics CGS 2835 Interdisciplinary Web Development
  • 35. Database Strengths  The power of a database and DBMS lies in the user’s ability to manipulate the data to turn up useful information. • Data can be sifted, sorted and queried through the use of data manipulation languages. CGS 2835 Interdisciplinary Web Development
  • 36. Data Manipulation Language • A Data Manipulation Language (DML) is a specific language provided with the DBMS that allows people and other database users to access, modify, and make queries about data contained in the database, and to generate reports. • Structured Query Language (SQL): The most popular DML. – SELECT * FROM EMPLOYEE WHERE JOB_CLASSIFICATION = ‘C2” CGS 2835 Interdisciplinary Web Development
  • 37. SQL Commands SELECT - extracts data from a database UPDATE - updates data in a database DELETE - deletes data from a database INSERT INTO - inserts new data into a database CREATE DATABASE - creates a new database ALTER DATABASE - modifies a database CREATE TABLE - creates a new table ALTER TABLE - modifies a table DROP TABLE - deletes a table CREATE INDEX - creates an index (search key) DROP INDEX - deletes an index From www.w3schools.com/sql CGS 2835 Interdisciplinary Web Development
  • 38. Employees Table SELECT SELECT field_names(s) FROM table_name Employee_Id LastName 1 Baldauf 2 Svendson 3 Pettersen 4 Willis 5 Smith FirstName Ola Jon Kari Carl Jason Address 120 Main St 3 Bogus Dr 2413 Sayer Ave 12 Bacon Cr Examples: SELECT LastName,FirstName FROM Employees LastName Baldauf Svendson Pettersen Willis Smith SELECT * FROM Employees Employee_Id LastName 1 Baldauf 2 Svendson 3 Pettersen 4 Willis 5 Smith CGS 2835 FirstName Ola Jon Kari Carl Jason FirstName Ola Jon Kari Address 120 Main St 3 Bogus Dr 2413 Sayer Ave City Chicago Tallahassee Tallahassee Carl Jason 12 Bacon Cr Atlanta Interdisciplinary Web Development City Chicago Tallahassee Tallahassee Atlanta
  • 39. Employees Table SELECT Employee_Id LastName 1 Baldauf 2 Svendson 3 Pettersen 4 Willis 5 Smith SELECT column_name(s) FROM table_name WHERE column_name operator value FirstName Ola Jon Kari Carl Jason Address 120 Main St 3 Bogus Dr 2413 Sayer Ave 12 Bacon Cr Example SELECT * FROM Employees WHERE LastName=’Willis' Employee_Id LastName 4 Willis CGS 2835 FirstName Carl Address 12 Bacon Cr City Atlanta Interdisciplinary Web Development City Chicago Tallahassee Tallahassee Atlanta
  • 40. SELECT Employees Table Employee_Id LastName 1 Baldauf 2 Svendson 3 Pettersen 4 Willis 5 Smith FirstName Ola Jon Kari Carl Jason Address 120 Main St 3 Bogus Dr 2413 Sayer Ave 12 Bacon Cr SELECT column_name(s) FROM table_name WHERE column_name operator value AND/OR column_name operator value Example SELECT * FROM Employees WHERE LastName=’Willis’ OR LastName=‘Pettersen’ Employee_Id LastName 3 Pettersen 4 Willis CGS 2835 FirstName Kari Carl Address City 2413 Sayer Ave Tallahassee 12 Bacon Cr Atlanta Interdisciplinary Web Development City Chicago Tallahassee Tallahassee Atlanta
  • 41. UPDATE Employees Table Employee_Id LastName 1 Baldauf 2 Svendson 3 Pettersen 4 Willis 5 Smith FirstName Ola Jon Kari Carl Jason Address 120 Main St 3 Bogus Dr 2413 Sayer Ave 12 Bacon Cr UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value Example UPDATE Employees SET Address=’2727 Monroe St', City=’Tallahassee' WHERE LastName=’Smith' AND FirstName=’Jason' Employee_Id LastName 1 Baldauf 2 Svendson 3 Pettersen 4 Willis 5 Smith CGS 2835 FirstName Ola Address 120 Main St City Chicago Jon Kari Carl Jason 3 Bogus Dr 2413 Sayer Ave 12 Bacon Cr 2727 Monroe St Tallahassee Tallahassee Atlanta Tallahassee Interdisciplinary Web Development City Chicago Tallahassee Tallahassee Atlanta
  • 42. INSERT INTO Employees Table Employee_Id LastName 1 Baldauf 2 Svendson 3 Pettersen 4 Willis 5 Smith FirstName Ola Jon Kari Carl Jason Address 120 Main St 3 Bogus Dr 2413 Sayer Ave 12 Bacon Cr City Chicago Tallahassee Tallahassee Atlanta INSERT INTO table_name (ColumnName1, … , ColumnNameN ) VALUES (‘data1’, … , ‘dataN’) Example INSERT INTO Employees (LastName, FirstName, Address, City) VALUES (‘Larkin’, ‘Robert’, ‘34 W 7th’, ‘Atlanta’) Employee_Id LastName 1 Baldauf 2 Svendson 3 Pettersen 4 Willis 5 Smith 6 Larkin CGS 2835 FirstName Ola Jon Kari Address 120 Main St 3 Bogus Dr 2413 Sayer Ave City Chicago Tallahassee Tallahassee Carl Jason Robert 12 Bacon Cr Atlanta 34 W 7th Atlanta Interdisciplinary Web Development
  • 43. DELETE Employees Table Employee_Id LastName 1 Baldauf 2 Svendson 3 Pettersen 4 Willis 5 Smith FirstName Ola Jon Kari Carl Jason DELETE FROM table_name WHERE some_column=some_value Example DELETE FROM Employees WHERE LastName=’Willis' AND FirstName=’Carl' Employee_Id LastName 1 Baldauf 2 Svendson 3 Pettersen 5 Smith CGS 2835 Address 120 Main St 3 Bogus Dr 2413 Sayer Ave 12 Bacon Cr FirstName Ola Address 120 Main St Jon Kari Jason 3 Bogus Dr Tallahassee 2413 Sayer Ave Tallahassee 2727 Monroe St Tallahassee Interdisciplinary Web Development City Chicago City Chicago Tallahassee Tallahassee Atlanta
  • 44. PHP > MySQL CGS 2835 Interdisciplinary Web Development
  • 45. Accessing a MySQL Database from PHP First create a database, table, and fields using phpMyAdmin 1.Establish a connection to mySQL server 2.Select the database 3.Use mysql_query to issue SQL commands CGS 2835 Interdisciplinary Web Development
  • 46. 1. Establish a Connection mysql_connect("2006.ispace.ci.fsu.edu", ”glm04", ”tm4bj9yc") or die(mysql_error()); CGS 2835 Interdisciplinary Web Development
  • 47. 2. Select the Database mysql_connect("2006.ispace.ci.fsu.edu", ”glm04", ”tm4bj9yc") or die(mysql_error()); mysql_select_db(’glm04_webdev') or die(mysql_error()); CGS 2835 Interdisciplinary Web Development
  • 48. 3. Use mysql_query to Issue Commands mysql_connect("2006.ispace.ci.fsu.edu", ”glm04", ”tm4bj9yc") or die(mysql_error()); mysql_select_db(’glm04_webdev') or die(mysql_error()); mysql_query("INSERT INTO visitors (name, email) VALUES('Timmy Mellowman', 'mellowman@fsu.edu' ) ") or die(mysql_error()); CGS 2835 Interdisciplinary Web Development
  • 49. 3. Use mysql_query to Issue Commands mysql_connect("2006.ispace.ci.fsu.edu", ”glm04", ”tm4bj9yc") or die(mysql_error()); mysql_select_db(’glm04_webdev') or die(mysql_error()); $result = mysql_query("SELECT * FROM visitors") or die(mysql_error()); while($row = mysql_fetch_array( $result )){ echo ”<p> Name: ".$row['name'] ."<br />"; echo "Email: ".$row['email'] ."<br />"; echo " Date: ".$row['date'] .”</p>"; } CGS 2835 Interdisciplinary Web Development
  • 50. Useful Resources • Tizag PHP/MySQL Tutorial – http://www.tizag.com/mysqlTutorial • W3Schools – PHP MySQL: http://www.w3schools.com/php/php_mysql_intro.asp – SQL: http://www.w3schools.com/sql/default.asp • MySQL Manual: – http://dev.mysql.com/doc/refman/5.0/en • PHP MySQL functions: – http://us3.php.net/manual/en/ref.mysql.php CGS 2835 Interdisciplinary Web Development