Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA

Slides:



Advertisements
Similar presentations
CSE 1561 A Brief MySQL Primer Stephen Scott. CSE 1562 Introduction Once you’ve designed and implemented your database, you obviously want to add data.
Advertisements

DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
MySQL Dr. Hsiang-Fu Yu National Taipei University of Education
PHP1-1 PHP & SQL Xingquan (Hill) Zhu
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
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.
ASP.NET Programming with C# and SQL Server First Edition
CHAPTER 7 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
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.
 Mysql – popular open-source database management system  PHP usually works with Mysql for web- based database applications  LAMP applications—Web-based.
Web Services Week 8 Aims: –Using web services as front ends to databases Objectives: –Review of relational databases –Connecting to and querying databases.
Dbwebsites 2.1 Making Database backed Websites Session 2 The SQL… Where do we put the data?
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.
Relational Database CISC/QCSE 810 some materials from Software Carpentry.
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
Installing and Using MySQL and phpMyAdmin. Last Time... Installing Apache server Installing PHP Running basic PHP scripts on the server Not necessary.
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.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
Database and mySQL Week 07 Dynamic Web TCNJ Jean Chu.
Technology & Management Club Development Software Overview.
Database Fred Durao What is a database? A database is any organized collection of data. Some examples of databases you may encounter in.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
Structure Query Language SQL. Database Terminology Employee ID 3 3 Last name Small First name Tony 5 5 Smith James
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
Internet Information Systems Writing to Databases and Amending Data.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
CS146 References: ORACLE 9i PROGRAMMING A Primer Rajshekhar Sunderraman
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
What’s a database? Data stored in a structured format that lends itself to easy manipulation and recall.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
Visual Programing SQL Overview Section 1.
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,
PHP and Mysql Database. PHP and Database Mysql – popular open-source database management system PHP usually works with Mysql for web-based database applications.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
>> Introduction to MySQL. Introduction Structured Query Language (SQL) – Standard Database Language – Manage Data in a DBMS (Database Management System)
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
1 Working with MS SQL Server Beginning ASP.NET in C# and VB Chapter 12.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
MySQL Tutorial. Databases A database is a container that groups together a series of tables within a single structure Each database can contain 1 or more.
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.
Chapter 12 Introducing Databases. Objectives What a database is and which databases are typically used with ASP.NET pages What SQL is, how it looks, and.
Web Systems & Technologies
Database Access with SQL
Chapter 5 Introduction to SQL.
CS320 Web and Internet Programming SQL and MySQL
Open Source Server Side Scripting Permissions & Users
Introduction to Web programming
Database application MySQL Database and PhpMyAdmin
Web Programming Week 3 Old Dominion University
CS1222 Using Relational Databases and SQL
ISC440: Web Programming 2 Server-side Scripting PHP 3
Chapter 7 Working with Databases and MySQL
Chapter 8 Working with Databases and MySQL
PHP and MySQL.
Introduction To Structured Query Language (SQL)
Introduction To Structured Query Language (SQL)
Web Programming Week 3 Old Dominion University
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
MySQL Database System Installation Overview SQL summary
Web Programming Week 3 Old Dominion University
Presentation transcript:

Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA

The MySQL Database System Database: collection of structured records MySQL = My Structured Query Language Database developed in the mid-90s but based on Relational Database Management System (RDBMS) and IBM’s SQL dating from the 70s

MySQL Usage Open Source and very popular as a database support to dynamic web applications – 6 million registered installations Popularly bundled with other Open Source solutions for web server, etc (e.g. LAMP) Accessible through a command line terminal or web client

MySQL in the DCU Context Accessible by command line SSH to student.dcu.ie Connect to mysql database Set up tables using commands This is not usual and in most cases a client like PHPMyAdmin is used!

Database Activities Use a database Create a table Alter/Delete tables Add or update records Delete records Read records

Selecting a DB and TABLE (If you have sufficient permissions on the system) you can create DATABASEs – By default on the DCU server you have one DATABASE named with your username CREATE DATABASE cm378; USE cm378; It’s unlikely you’ll need to create and use any other DATABASE Within each database, you can have unlimited TABLEs

What is a TABLE Think of it like an excel worksheet Columns are the categories (fields) Rows are the entries (records)

Working with a TABLE To create a table, its fields have to be defined (name and type) – CREATE TABLE addressbook (id INT, firstname TEXT, surname TEXT, TEXT); To delete, use DROP – DROP TABLE addressbook; To check the format, use DESCRIBE – DESCRIBE addressbook;

Adding a Record To add a new record, use the INSERT command: – Format is always: INSERT INTO table_name (field_name) VALUES (“value”); – Not all fields need to be filled! – INSERT INTO addressbook (id, firstname, surname) VALUES (5, “Bob”, “Loblaw”);

Updating an existing record To change an existing record, use UPDATE This command specifies the table to update and uses SET to set a field in a record to a new value. The WHERE command can then be used to locate which record to change: UPDATE addressbook SET WHERE surname = “Loblaw”;

Deleting a record A record can be deleted using the DELETE command to specify which TABLE to delete from and a WHERE command to specify the record(s) to delete – DELETE FROM addressbook WHERE id=3;

Selecting a record: Search The SELECT command can be used to search for a particular record by matching the value in a field – SELECT * FROM addressbook WHERE id=2; Particular fields of a record can be recalled: – SELECT firstname, surname FROM addressbook WHERE id=4;

Selecting a record: Search Instead of matching an exact field entry, MySQL can search for a partial match using the % wildcard: – SELECT * FROM addressbook WHERE LIKE “%dcu.ie”;

Selecting a record: Search Where multiple records are returned, their order can be set using a field: – SELECT * FROM addressbook WHERE LIKE ORDER BY firstname; The order can be reversed by using a command to order descending (ORDER BY field DESC;)