_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.

Slides:



Advertisements
Similar presentations
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
Advertisements

Murach’s Java SE 6, C21© 2007, Mike Murach & Associates, Inc.Slide 1.
Chapter Information Systems Database Management.
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
By Mary Anne Poatsy, Keith Mulbery, Eric Cameron, Jason Davidson, Rebecca Lawson, Linda Lau, Jerri Williams Chapter 10 Using Macros and SQL in Access 1.
CSC 2720 Building Web Applications Database and SQL.
Chapter 12 Information Systems. 2 Chapter Goals Define the role of general information systems Explain how spreadsheets are organized Create spreadsheets.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
CORE 2: Information systems and Databases STORAGE & RETRIEVAL 2 : SEARCHING, SELECTING & SORTING.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
Chapter 12 Information Systems. 2 Chapter Goals Define the role of general information systems Explain how spreadsheets are organized Create spreadsheets.
CSCI 6962: Server-side Design and Programming
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
Introduction –All information systems create, read, update and delete data. This data is stored in files and databases. Files are collections of similar.
CHAPTER 7 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
Introduction to Accounting Information Systems
CIS 270—Application Development II Chapter 25—Accessing Databases with JDBC.
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
Information Systems: Databases Define the role of general information systems Describe the elements of a database management system (DBMS) Describe the.
Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases.
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
Database Queries. Queries Queries are questions used to retrieve information from a database. Contain criteria to specify the records and fields to be.
CHAPTER 8 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Using Special Operators (LIKE and IN)
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
1 CS 430 Database Theory Winter 2005 Lecture 2: General Concepts.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
SQL Basic. What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database.
Advanced Database CS-426 Week 1 - Introduction. Database Management System DBMS contains information about a particular enterprise Collection of interrelated.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 22 - SQL, MySQL, DBI and ADO Outline 22.1 Introduction 22.2 Relational Database Model 22.3 Relational.
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
WEEK# 12 Haifa Abulaiha November 02,
Database: SQL, MySQL, LINQ and Java DB © by Pearson Education, Inc. All Rights Reserved.
Lecture Access – Queries. What’s a Query? A question you ask a database –ie: “Who are my Stockton customers?” –ie: “How much did Bob sell on the 14th?”
Chapter 3: Relational Databases
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
CSC314 DAY 8 Introduction to SQL 1. Chapter 6 © 2013 Pearson Education, Inc. Publishing as Prentice Hall SQL OVERVIEW  Structured Query Language  The.
1 Database Fundamentals Introduction to SQL. 2 SQL Overview Structured Query Language The standard for relational database management systems (RDBMS)
Create Views Using a Graphical Designer Database Administration Fundamentals LESSON 2.3b.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Introduction to Business Information Systems by Mark Huber, Craig Piercy, Patrick McKeown, and James Norrie Tech Guide D: The Details of SQL, Data Modelling,
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
Understand Data Definition Language (DDL) Database Administration Fundamentals LESSON 1.4.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Query Methods Simple SQL Statements Start ….
CS SQL.
Chapter 5 Introduction to SQL.
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
 2012 Pearson Education, Inc. All rights reserved.
Understand Data Manipulation Language (DML)
Chapter 12 Information Systems.
Information Systems Database Management
Understand Data Manipulation Language (DML)
Structured Query Language (SQL) William Klingelsmith
Accounting System Design
Week 11: Database Management System
Insert, Update, Delete Manipulating Data.
CIS16 Application Programming with Visual Basic
Chapter 22 - SQL, MySQL, DBI and ADO
Data Model.
Accounting System Design
Chapter 9 Query-by-Example Pearson Education © 2009.
Presentation transcript:

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1  Wiley and the book authors 2001 E-Commerce: Fundamentals and Applications Chapter 5 : Server-Side Programming II Database Connectivity

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications2  Wiley and the book authors 2001 Outline Overview of relational database systems Common SQL commands and their usage

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications3  Wiley and the book authors 2001 Relational database Database: a shared collection of interrelated data in a structured form. Relational database: uses relations to represent entities and relationships (the E-R relationship). Schema: describes the structure of the database. The relations are essentially "tables". These tables can be manipulated using SQL (Structured Query Language). Fig. 5.1 shows a snapshot of BOOK database which contains three related tables.

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications4  Wiley and the book authors 2001 Snapshot of BOOK Database (Fig. 5.1)

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications5  Wiley and the book authors 2001 Basic SQL statements In this chapter, we will provide a brief overview of SQL (The Structured Query Language) using the BOOK database as an example of how to manipulate a relational database based on SQL commands. There are four different basic SQL statements. They are:  SELECT statement;  INSERT statement;  UPDATE statement; and  DELETE statement.

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications6  Wiley and the book authors 2001 SELECT Statement The SELECT command displays the results according to the user’s specified condition(s). A typical form of the SELECT statement is given by: SELECT fields FROM table WHERE criteria Example SELECT ISBN, Name FROM sbook WHERE Publisher='Wiley'  It displays all the records with Publisher name "Wiley" and the records will contain only the fields (ISBN, Name) as shown in Fig. 5.2.

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications7  Wiley and the book authors 2001 Conditional Query on sbook Table (Fig. 5.2) ISBNName Java Electronic Commerce Sourcebook E-commerce Security

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications8  Wiley and the book authors 2001 Composite SELECT Statement Actually, we can link-up different tables during a query. Let’s see the following example: SELECT Customer.Customer_ID, Customer.Firstname, Transaction.Transaction_No, Transaction.ISBN FROM Customer, Transaction WHERE Customer.Customer_ID = Transaction.Customer_No AND Customer.Customer_ID='JO321' A snapshot of the search result is shown in Fig. 5.3.

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications9  Wiley and the book authors 2001 A Composite Query on Customer and Transaction Tables (Fig. 5.3) Customer_IDFirstnameTransaction_NOISBN JO321Jones JO321Jones JO321Jones JO321Jones

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications10  Wiley and the book authors 2001 INSERT Statement The INSERT statement is for adding new rows to a table. INSERT statement comes in two different forms  allows the user to add only a single new row  allows the user to add a set of rows to a table using information from another table. INSERT statement to add a new row  The typical form of this SQL INSERT is: INSERT INTO table (field_name1, field_name2,.., field_nameN) VALUES (field_value1, field_value2, …, field_valueN )

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications11  Wiley and the book authors 2001 INSERT to Add New Record (Fig. 5.4) Customer_IDLastnameFirstnameTel no CH222SimonChan CL444TimClarke JO321LarryJones LE123LeePeter TO133TommyRaymond Example INSERT INTO Customer (Customer_ID, Lastname, Firstname, “Tel no”) VALUES (’TO133', 'Tommy', ’Raymond', ' ')

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications12  Wiley and the book authors 2001 UPDATE Statement The UPDATE statement is used to modify the value(s) of the data within a table, and the typical form of it is: UPDATE table SET field_name1 = field_value1, field_name2 = field_value2,.., field_nameN = field_valueN [WHERE ] Using the UPDATE statement, we can also modify the specified record(s) utilising some calculations. Example:  Update transaction no ‘0010’ (in transaction table) for buying 2 books instead of 1 book and recalculate the total amount as well: UPDATE Transaction SET Qty = 2, Total = Total * 2 WHERE Transaction_No = ‘0010’

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications13  Wiley and the book authors 2001 Using UPDATE Statement to Modify Transaction Table (Fig. 5.5) Transaction_NoCustomer_N o DateISBNQtyTotal 0001JO3211/1/ $ JO3211/1/ $ JO3211/1/ $ LE1231/5/ $ LE1231/5/ $ CL4441/5/ $ CL4441/5/ $ CL4441/5/ $ JO3211/10/ $ CH2221/18/ $456.00

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications14  Wiley and the book authors 2001 DELETE Statement The DELETE statement is used to remove a record or a series of records from a table under specific condition(s). The typical form of it is given by: DELETE FROM table [WHERE ] Using the Customer Table as an example, we can delete all the records with Lastname(s) containing the character “i” by using the following statement: DELETE FROM Customer WHERE Lastname LIKE ‘%i%’

_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications15  Wiley and the book authors 2001 Customer Table After DELETE Operation (Fig. 5.6) Customer_IDLastnameFirstnameTel no CH222ChanSimon CR443JaneCraw JO321LarryJones TO133TommyRaymond LE123LeePeter