Download E-Commerce Databases Database design

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
E-Commerce Databases
Database design
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
1
SQL
• Structured Query Language (SQL)
• Standard for Relational Databases
• Create, Delete, Update, Query data
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
2
Creating a Database
• Commands
– CREATE DATABASE database-name;
– DROP DATABASE database-name;
• A database contains a number of tables
• Tables contain a number of attributes
• Tables store records (with attribute values)
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
3
Create DB with
phpMyAdmin
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
4
Creating a Table
• See Code Example CREATE TABLE command in Notes Page
• includes the definition of attributes and their data types
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
5
Create Table with
phpMyAdmin
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
6
Create Table Attributes
with phpMyAdmin
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
7
Edit Table Attributes with
phpMyAdmin
In Tree
Select
Opens
wizard to
change
Drops Field
from Table
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Sets
Primary
Key
Creates Index
for
Performance
Database Design
Ver: 1.0
8
Editing Tables in DB with
phpMyAdmin
Browse
through all
records
Drop the
entire table
Query by
Example
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Delete all
records
from table
Insert new
record
Database Design
Ver: 1.0
9
Running First Queries
• SELECT ... Fields to display
• FROM ... Tables affected in the query
• WHERE ... Conditions deciding which records to display
Simple Example
SELECT * FROM `products` WHERE price < 100;
Displays products costing less than 100 Euro.
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
10
Queries Across Tables
Simple Example
SELECT products.productname, products.price
FROM `products`,`sales`,`customers`
WHERE products.prod_id = sales.prod_id AND sales.cus_id =
customers.cus_id AND customers.cus_id = 1;
• Displays name and price of products ordered
by customer with customer id 1
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
11
Exercise 2 Master
Example 1
• Enter tables, attributes and first records for a
typical customer and product sales situation
including stock control into the database using
the phpMyAdmin wizard
• Run and demonstrate a first query
• Take about 1 hour exercise for that
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
12
Exercise 2 Master
Example 2
• Enter tables, attributes and first records for a
typical e-newspaper ordering site with
customers, newspapers to select, newspapers
to renew and to administer sales and payments
into the database using the phpMyAdmin
wizard
• Run and demonstrate a first query
• Take about 1 hour exercise for that
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
13
References
• http://www.sqlcourse.com/
• http://www.databasejournal.com/features/mysql
• PHP and MySQL Web Development, Second Edition -- by Luke
Welling, Laura Thomson; Paperback
• MySQL, Second Edition -- by Paul DuBois; Paperback
• Open Source Web Development with LAMP: Using Linux, Apache,
MySQL, Perl, and PHP by James B. Lee, Brent Ware (Paperback)
E-COMMERCE JOBS
This project (Project number: HU/01/B/F/PP-136012)
is carried out with the financial support of the
Commssion of the European Communities
under the Leonardo da Vinci Programme
Database Design
Ver: 1.0
14
Related documents