NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.

Slides:



Advertisements
Similar presentations
PHP II Interacting with Database Data. The whole idea of a database-driven website is to enable the content of the site to reside in a database, and to.
Advertisements

What is MySQL? MySQL is a relational database management system (A relational database stores data in separate tables rather than putting all the data.
NMED 3850 A Advanced Online Design February 25, 2010 V. Mahadevan.
PHP (2) – Functions, Arrays, Databases, and sessions.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
MIS2502: Data Analytics MySQL and SQL Workbench David Schuff
Integrating Databases into the Web with PHP/MySQL CS 4000.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
INTERNET APPLICATION DEVELOPMENT For More visit:
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
ASP.NET Programming with C# and SQL Server First Edition
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
About Dynamic Sites (Front End / Back End Implementations) by Janssen & Associates Affordable Website Solutions for Individuals and Small Businesses.
Introduction to SQL Steve Perry
2440: 141 Web Site Administration Database Management Using SQL Professor: Enoch E. Damson.
Open Source Software Unit – 2 Presented By Mr. R.Aravindhan.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Introduction to databases and SQL. What is a database?  A database is an organized way of holding together pieces of information  A database refers.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
Class 1Intro to Databases Goals of this class Understand the architecture behind web database applications Gain a basic understanding of what relational.
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Introduction to Internet Databases MySQL Database System Database Systems.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Database: SQL and MySQL
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Introduction to Databases Trisha Cummings. What is a database? A database is a tool for collecting and organizing information. Databases can store information.
1 Welcome to CSC 301 Web Programming Charles Frank.
Chapter 10: The Data Tier We discuss back-end data storage for Web applications, relational data, and using the MySQL database server for back-end storage.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Database Management Systems.  Database management system (DBMS)  Store large collections of data  Organize the data  Becomes a data storage system.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
What’s a database? Data stored in a structured format that lends itself to easy manipulation and recall.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
Class 1Intro to Databases Goals of this class Understand the architecture behind web database applications Gain a basic understanding of what relational.
NMED 3850 A Advanced Online Design January 14, 2010 V. Mahadevan.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 1: Introduction to IS2803 Rob Gleasure
CP476 Internet Computing Perl CGI and MySql 1 Relational Databases –A database is a collection of data organized to allow relatively easy access for retrievals,
Database: SQL, MySQL, LINQ and Java DB © by Pearson Education, Inc. All Rights Reserved.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
MYSQL AND MYSQL WORKBENCH MIS2502 Data Analytics.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
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.
Introduction to Database Programming with Python Gary Stewart
 MySQL is a database system used on the web  MySQL is a database system that runs on a server  MySQL is ideal for both small and large applications.
Web Systems & Technologies
Chapter 5 Introduction to SQL.
Introduction to Dynamic Web Programming
CS320 Web and Internet Programming SQL and MySQL
JDBC.
CS3220 Web and Internet Programming SQL and MySQL
PHP and MySQL.
MySQL Database System Installation Overview SQL summary
CS3220 Web and Internet Programming SQL and MySQL
Web Application Development Using PHP
Presentation transcript:

NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan

Overview  Some background material.  Simple SQL.  Lab Tasks.  References.

3-tier Client-Server Architecture  Client: makes requests for information. E.g. web browser, ftp client.  Server: responds to requests for information from clients. E.g. web server, ftp server.  Serving static web pages to a web browser is often implemented using a 2-tier Client-Server Architecture.  Dynamic (interactive) content is typically implemented using a 3-tier Client-Server Architecture.

3-tier Client-Server Architecture (cont.)

 Presentation tier: Provides the user interface and displays results in a human readable format.  Business Logic tier: Performs calculations and data processing.  Database tier: Provides storage and retrieval of information.

3-tier Client-Server Architecture (cont.)  The order of operations is as follows:  A request is made by the user at the Presentation Tier (for example, a form in a web page).  The request is then submitted to the Business Logic Tier for processing (for example, an application running on a web server).  The Business Logic Tier then queries the Database for the required information.  The Database retrieves the required information and returns it to the Business Logic Tier.  The Business Logic Tier then does any required processing of the information and returns the result to the Presentation Tier.  The Presentation Tier presents the result in human readable format to the user.

Apache httpd, PHP, and MySQL  Apache httpd: The most popular web server on the world wide web.  PHP: Scripting language for dynamic web page creation.  MySQL: Advanced relational database management system.  Combine the above ingredients to build interactive, feature-rich websites.

Simple SQL  SQL: Structured Query Language.  Standardized language to retrieve data from relational databases.  Earlier, non-relational databases consisted simply of flat files that stored data separated by a delimiter (such as a carriage return (“\n”). For example, consider a plain text file: last_name, first_name, age Smith, Bob, 21 Jones, Robert, 23  The above is a database, but it is rather difficult to extract information from it without writing a text parser. Additionally, it becomes troublesome when there are a large number of records as you need to parse the file sequentially to find a particular data element (of which there could be thousands).

Simple SQL (cont.)  A relational database uses the concept of relations (tables) to store data (much like a spreadsheet):  SQL allows you to write a query to quickly find the data you are looking for e.g. find all people with the last name “Jones” without having to sequentially parse the entire database file.  Each row in the table is known as a tuple. person_idlast_namefirst_nameage 1SmithBob21 2JonesRobert23

Simple SQL (cont.)  Once the database table(s) are defined, several operations can be performed on them.  Inserting data;  Retrieving data;  Updating data;  Deleting data.  SQL has a standard syntax for each of these operations.  But you have to CREATE the table first.

Simple SQL (cont.)  To create the table Person described earlier using standard SQL syntax:  CREATE table Person (person_id INT, last_name VARCHAR(20), first_name VARCHAR(20), age INT);  To confirm that the table has indeed been created, use the following command:  SHOW tables;

Simple SQL (cont.)  So what exactly did we just do?  Created a table called Person in the MySQL database management system (DBMS).  The syntax is broken down as follows:  CREATE table Person  create a table called “Person”.  (person_id INT,  create an attribute called “person_id” with the data type INT i.e. an Integer (whole number).  last_name VARCHAR(20),  create an attribute called “last_name” with the data type VARCHAR(20) i.e. text 20 characters long.  first_name VARCHAR(20),  create an attribute called “first_name” with the data type VARCHAR(20) i.e. text 20 characters long.  Age INT);  create an attribute called “age” with the data type INT i.e. an Integer (whole number).

Simple SQL (cont.)  So now that we have the table created, we can populate it with data.  Inserting data into a table is achieved using the INSERT keyword.  For example, to insert 2 rows into the table Person, the following syntax can be used:  INSERT INTO Person VALUES(1, 'Smith', 'Bob', 21);  INSERT INTO Person VALUES(2, 'Jones', 'Robert', 23);

Simple SQL (cont.)  The syntax is broken down as follows:  INSERT INTO Person  insert a row into the table Person.  VALUES(1, 'Smith', 'Bob', 21);  the row will have the values 1, ‘Smith’, ‘Bob’, 21 which correspond to the table definition of person_id, last_name, first_name, age in that order.

Simple SQL (cont.)  Once some data is inserted into the table, we can then retrieve it by running SELECT queries on the table.  Here are some examples of SELECT queries:  SELECT * FROM Person;  The above query returns all the rows and columns from table Person.  SELECT * FROM Person WHERE last_name = ‘Jones’;  The above query returns all the rows and columns from table Person where the last name is “Jones”.  SELECT * FROM Person WHERE age = 23;  The above query selects all the rows and columns from table Person where the age is 23.

Simple SQL (cont.)  The syntax can be broken down as follows:  SELECT * FROM Person  select all columns from table Person.  WHERE age = 23;  return only the rows where the age attribute is equal to 23.  SELECT statements can be modified in different ways. For example, you can select just the first column (last_name) or use a greater than operator (>) for age:  SELECT last_name FROM Person;  SELECT * from Person WHERE age > 18;

Simple SQL (cont.)  Existing data in a table can also be updated using the keyword UPDATE.  An example of updating the last name:  UPDATE Person SET last_name = ‘Graham’ WHERE person_id = 2;  The above will set the last_name to “Graham” on the row where the person_id field is equal to 2.  Another example, updating the first name based on the last name condition:  UPDATE Person SET first_name = ‘Will’ WHERE last_name = “Smith”;

Simple SQL (cont.)  Lastly, exisiting rows can also be deleted from a table as follows:  DELETE FROM Person WHERE person_id = 1;  The above will delete the row where person_id is equal to 1.  DELETE FROM Person WHERE last_name = ‘Graham’;  The above will delete the row where last_name is equal to “Graham”;

Lab Tasks  Login to the Linux server “newmedia.sfa.uleth.ca” using PuTTY.  Login to the MySQL command line using the command:  mysql --user= --password=  is your provided username, password is your provided password, dbname is your provided database name.  Run all the example SQL statements provided in the previous slides.  When you are done, destroy the entire Person table using the command:  DROP TABLE Person;

Lab Tasks (cont.)  Think of a new table to add to the database with at least 5 attributes i.e. 5 columns.  CREATE the table in your MySQL database.  INSERT at least 5 rows of data into the table.  Write at least 3 SELECT statements, each based on different selection criteria (i.e. different WHERE clauses).  Write at least 3 UPDATE statements, each based on different updating criteria (i.e. different WHERE clauses).  Write at least 3 DELETE statements, each based on different deletion criteria (i.e. different WHERE clauses).

Lab Tasks (cont.)  Copy and paste the output from your MySQL session into a Word document.  Write a paragraph or two describing your understanding of tables, namely creation, insertion of data, selection of data, updating of data, and deletion of data. Is there anything confusing about the process? What sort of data are you trying to store in your new table?  the word document to me.

Hosting Services  Most web hosts today offer web hosting, scripting (PHP, JSP, ASP, etc.), and databases (MySQL, PostgreSQL) in a standard package.  Management is provided via a web interface or command line interface.  Uploads of user files are done via ftp or sftp.  Site for web host reviews:

References  MySQL 5.0 Reference Manual: