Web Design: Basic to Advanced Techniques Fall 2010 Mondays 7-9pm 200 Sutardja-Dai Hall Databases & SQL Lecture Code:

Slides:



Advertisements
Similar presentations
NMED 3850 A Advanced Online Design February 25, 2010 V. Mahadevan.
Advertisements

15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Multiple Tiers in Action
Getting Started Chapter One DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 5 th Edition.
Getting Started Chapter One DATABASE CONCEPTS, 7th Edition
Why Databases.
Databases Dan Otero Alex Loddengaard
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
Getting Started Chapter One DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
With Microsoft Access 2007 Volume 1© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access 2007 Volume 1 Chapter.
Server-side Scripting Powering the webs favourite services.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor Ms. Arwa.
Web Application Development. Tools to create a simple web- editable database QSEE MySQL (or PHPMyAdmin) PHP TableEditor.
Simple Database.
CSS/Photoshop Layouts – Quiz #7 Lecture Code:
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
MET280: Computing for Bioinformatics Introduction to databases What is a database? Not a spreadsheet. Data types and uses DBMS (DataBase Management System)
JavaScript – Quiz #9 Lecture Code:
Feedback #2 (under assignments) Lecture Code:
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.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
MS3304: Week 7 Talking to Databases: SQL Basics. Overview Connecting to a database Querying a database Basic SQL syntax for mySQL Writing simple and complex.
PHP and MySQL CS How Web Site Architectures Work  User’s browser sends HTTP request.  The request may be a form where the action is to call PHP.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Today’s Agenda Course Facilitator Introduction Announcements Quiz Servers and Clients URLs Dreamweaver Setup HTML Introduction – Part 2.
DAY 12: DATABASE CONCEPT Tazin Afrin September 26,
Dynamic Pages – Quiz #11 Feedback (under assignments) Lecture Code:
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.
1 The Information School of the University of Washington Dec 1fit advdatabases © 2006 University of Washington Advanced Database Concepts INFO/CSE.
Web Design: Basic to Advanced Techniques Fall 2010 Mondays 7-9pm 200 Sutardja-Dai Hall Introduction to PHP.
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 1: Introduction to IS2803 Rob Gleasure
Relational Databases and MySQL. Relational Databases Relational databases model data by storing rows and columns in tables. The power of the relational.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
1 Welcome! DBT544 students to the iSeries, DB2 Universal Database And SQL interface.
uses of DB systems DB environment DB structure Codd’s rules current common RDBMs implementations.
Introduction to Databases & SQL Ahmet Sacan. What you’ll need Firefox, SQLite plugin Mirdb and Targetscan databases.
Basics Components of Web Design & Development Basics, Components, Design and Development.
Introduction to Database Programming with Python Gary Stewart
Introduction to Dynamic Web Programming
Microsoft Access 2003 Illustrated Complete
Website Development Basics with PHP MySQL
Database Driven Websites
ISC440: Web Programming 2 Server-side Scripting PHP 3
Chapter 8 Working with Databases and MySQL
PHPMyAdmin.
Structured Query Language
Intro to Relational Databases
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Advanced Database Concepts: Reports & Views
CS3220 Web and Internet Programming SQL and MySQL
Database Management Systems
CS4433 Database Systems Project.
Getting Started Chapter One DATABASE CONCEPTS, 5th Edition
Client-Server Model: Requesting a Web Page
Web Application Development Using PHP
Presentation transcript:

Web Design: Basic to Advanced Techniques Fall 2010 Mondays 7-9pm 200 Sutardja-Dai Hall Databases & SQL Lecture Code:

Today’s Agenda Quiz Lecture Lab

Announcements Final Project Specs up this week

What is MySQL? Client Side Web Browser HTTP Request (visit website) Interpret and render received files JavaScript Execution Server Side Web Server Serve Website Send HTML, CSS, and JavaScript files Send images Interprets and executes PHP code PHP code calls/talks to Database

What is MySQL? MySQL is a brand of database software Relational database management system (RDMS) Named after original developer’s daughter: My Closely used with PHP, and partial reason for success Used by Google, Wikipedia, Facebook, YouTube…

Other Systems MySQL PostgreSQL SQLite Microsoft SQL Server Notice “SQL”. Pronounced “sequel”.

Where do Databases Fit In?

Client Server.

Web Server Communication 1. Open URL industries.com/mylife.phphttp://jonathanmui.aw- industries.com/mylife.php 2. Web Server receives request and determines it is a php file, so it will send processing to the PHP interpreter. 3. Interpreter looks up File System 4. File system returns the corresponding file 5. Interpreter looks up database 6. Database returns result set 7. PHP Interpreter does work on the data obtained, then translates all that into HTML 8. Web Server serves you the HTML <?php print("Family & Friends"); $album_files = scandir("Pics"); for($index = 2; $album_files[$index]; $index++){?> > <?php } ?>

Use Cases Directory Services User authentication Banking Reservations Browser cache Many, many things! What about our Cal student information? Our grades?

SQL Structured Query Language Databases are not just a repository of information Can ask the database questions about the data How many students are enrolled in the DeCal? What is their average attendance rate? How many have turned in all assignments? Which student is doing the best in the course? Does a user with this password exist? Need to maintain the data Create, Read, Update, Delete

CRUD Create "INSERT INTO `products` (`name`,`price`) VALUES (‘Tonka truck’, ‘13.00’)" Read "SELECT `index`, `name` FROM `products`" Update “UPDATE `products` SET `price` = WHERE `name` = ‘Tonka truck’” Delete “DELETE FROM `products` WHERE `name` = ‘Tonka truck’”

How is Data Stored in a Database? P_IDNAMEPRICE 1Kerbie & Ban Townhouse Tonka Truck Brain Yo-Yo13.00 VarcharDecimalInteger A unique “Primary Key” Products

How is Data Stored in a Database? A: In Relational Tables Each table has a name Columns have labels Each column stores a different type of data An entry in a database appears as a ROW Each column in the row has a value All rows have a key – a unique identifier Typically an integer

Data Types Integer Double Float Varchar Longtext Boolean …

Relationships Let’s model…relationships: Girlfriend and Boyfriend G_IDNAME 1Jessica 2Portia 3Jane B_IDNAMEG_ID 1Bob3 2Kensington2 3Billy1 GirlfriendsBoyfriends Foreign Key

Some Terminology Primary Key A primary key is used to uniquely identify each row in a table. It can either be part of the actual record itself, or it can be an artificial field (one that has nothing to do with the actual record). A primary key can consist of one or more fields on a table. When multiple fields are used as a primary key, they are called a composite key Foreign Key A field (or fields) that points to the primary key of another table. The purpose of the foreign key is to ensure referential integrity of the data References:

Boyfriend(s) Portia seduces Billy… G_IDNAME 1Jessica 2Portia 3Jane B_IDNAMEG_ID 1Bob3 2Kensington2 3Billy1 2 GirlfriendsBoyfriends

Girlfriend(s) Bob picks up the slack… G_IDNAME 1Jessica 2Porschea 3Jane B_IDNAMEG_ID 1Bob ? 2Kensington2 3Billy2 GirlfriendsBoyfriends

Better Relationship G_IDNAME 1Jessica 2Portia 3Jane B_IDNAME 1Bob 2Kensington 3Billy GirlfriendsBoyfriends G_IDB_ID Relationships Portia and Kensington Portia and Billy Jane and Bob Jessica and Bob Modeling

Relationship Types “One to Many” “Many to Many” GirlfriendsBoyfriends GirlfriendsBoyfriends Relationships

phpMyAdmin

CRUD Create INSERT INTO ( ) VALUES ( ) Read SELECT FROM WHERE Update UPDATE SET = WHERE Delete DELETE FROM WHERE

SQL Examples S_IDNameGrade JonathanA AmberC AlexF TimA MikeB Students How do we find the name of all students with an A? How do we delete Alex’s row? How do we edit Amber’s grade from an F to an A? How do we add Alex with an A? SELECT Name FROM Students WHERE Grade = A DELETE FROM Students WHERE S_ID = UPDATE Students SET Grade = A WHERE S_ID = INSERT INTO Students (Name, Grade) VALUES (‘Alex’, ‘A’)

Index These allow the SQL query to search the tables faster Syntax CREATE INDEX “ ” ON “ ” (column_name) CREATE INDEX “StudentNames” ON “Students” (name)

Join Allows us to create relationships on the fly. Simply selecting multiple tables SELECT * FROM WHERE SELECT * FROM Girlfriends, Boyfriends WHERE Girlfriends.G_ID = Boyfriends.G_ID AND Girlfriends.G_ID = 1

PHP and MySQL Print titles from all the entries in our blogs table

PHP and MySQL Get contents of a blog with a requested title View.php?title=Octopi and Unicorns

PHP and MySQL Insert new entry into blogs table

PHP and MySQL