Session 5: Working with MySQL iNET Academy Open Source Web Development.

Slides:



Advertisements
Similar presentations
Session 2Introduction to Database Technology Data Types and Table Creation.
Advertisements

MySQL Access Privilege System
Introduction to Structured Query Language (SQL)
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2010 All Rights Reserved. 1.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
DT211 Stage 2 Databases Lab 1. Get to know SQL Server SQL server has 2 parts: –A client, running on your machine, in the lab. You access the database.
Introduction to Structured Query Language (SQL)
Creating Database Tables CS 320. Review: Levels of data models 1. Conceptual: describes WHAT data the system contains 2. Logical: describes HOW the database.
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.
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2010 All Rights Reserved. 1.
Structured Query Language SQL: An Introduction. SQL (Pronounced S.Q.L) The standard user and application program interface to a relational database is.
MySql In Action Step by step method to create your own database.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
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:
ASP.NET Programming with C# and SQL Server First Edition
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Creating Databases with MySQL Workbench Build the Forums database in Ullman’s Chapter 6.
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.
1 Working with MS SQL Server Textbook Chapter 14.
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.
Installing and Using MySQL and phpMyAdmin. Last Time... Installing Apache server Installing PHP Running basic PHP scripts on the server Not necessary.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Database and mySQL Week 07 Dynamic Web TCNJ Jean Chu.
Key Applications Module Lesson 21 — Access Essentials
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2015, Fred McClurg, All Rights.
Chapter 17 Creating a Database.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Chapter 5 MYSQL Database. Introduction to MYSQL MySQL is the world's most popular open-source database. Open source means that the source code, the programming.
Oracle 11g DATABASE DEVELOPMENT LAB1. Introduction  Oracle 11g Database:-  Oracle 11g database is designed for some features, which helps to the organizations.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting MySQL – Inserting Data.
Topic 1: Introduction to SQL. SQL stands for Structured Query Language. SQL is a standard computer language for accessing and manipulating databases SQL.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Visual Programing SQL Overview Section 1.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
What is MySQL? MySQL is a relational database management system (RDBMS) based on SQL (Structured Query Language). First released in January, Many.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Introduction to MySQL Ullman Chapter 4. Introduction MySQL most popular open-source database application Is commonly used with PHP We will learn basics.
Installation Oracle 11g Express 2 double click the "setup" button to install the Oracle.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
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.
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
Software-Projekt 2008 Seminarvortrag“Short tutorial of MySql“ Wei Chen Verena Honsel.
Lec-7. The IN Operator The IN operator allows you to specify multiple values in a WHERE clause. SQL IN Syntax SELECT column_name(s) FROM table_name WHERE.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Intro to MySQL.
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.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
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.
3 A Guide to MySQL.
Chapter 5 Introduction to SQL.
Insert, Update and the rest…
Database application MySQL Database and PhpMyAdmin
ORACLE SQL Developer & SQLPLUS Statements
ISC440: Web Programming 2 Server-side Scripting PHP 3
Chapter 7 Working with Databases and MySQL
Chapter 8 Working with Databases and MySQL
PHPMyAdmin.
CS122 Using Relational Databases and SQL
CS1222 Using Relational Databases and SQL
CS122 Using Relational Databases and SQL
Presentation transcript:

Session 5: Working with MySQL iNET Academy Open Source Web Development

Objectives Introduction of MySQL Managing the Database Using phpMyAdmin & SQLyog Structure Query Language

MySQL Database MySQL client interface Login: require an username and a password Different user has different access level to databases and tables To connect to a MySQL Database we need The IP address of the database server The name of the database The username The password Several ways to connect to MySQL database The command line phpMyAdmin SQLyog

Accessing DB from the Command Line Using MySQL command-line client. First, open the OS command line Type mysql -h hostname –u user -p

Prompts & Commands At the MySQL prompt, user can enter database command followed by Enter To see the list of commands that MySQL supports, type help or \h Eg: show databases, use

Managing the Database Creating Users Creating users need root permission Creating a database Using a database

Using phpMyAdmin Go to the website Download the package phpMyAdmin …..zip Unpack to the C:\www\myadmin Create folder C:\www\myadmin\config In your web browser, navigate to /scripts/setup.php

Using phpMyAdmin (cont.) In the Servers section, click the Add button. The Server setup page displays as following

Using phpMyAdmin (cont.) Most of the default values can be left alone. You do need to enter the password for the root MySQL user in the “Password for config auth” field. Select “cookie” from Authentication type to limit access to your MySQL data to only users with a MySQL account. Click Add Click “Save” from the Configuration section to save your changes to the configuration file. Copy the config.inc.php file tp myadmin. Remove the config directory

Using phpMyAdmin (cont.) In your web browser, navigate to Your web browser displays a login page as followinghttp://localhost/myadmin

Using SQLyog Go to the \\dc computer and download the SQLyog519.exe\\dc Install SQLyog using Installation Wizard Run the SQLyog program Type the root’s password Click “Connect”

Using SQLyog (cont.) The main window of SQLyog displays as following

Database Concept & SQL Database are repository of structured information SQL: Structured Query Language is the language used to manage and manipulate data stored in relational database

Creating tables The title_id column is an integer. The auto_increment keyword make this field’s value automatically is assigned an unique value during row insertion. The title column holds text up to 150 characters The pages column is an integer The PRIMARY KEY attribute tells MySQL which fields is the key value

Creating Tables (cont.) To verify a table, use DESCRIBE

Adding Data to Table Use INSERT command. Syntax: INSERT INTO table COLUMNS ([columns]) VALUES ([values]); Rules: Numeric values shouldn’t be quoted String values should always be quoted Date and time value should always be quoted Function shouldn’t be quoted NULL should never be quoted

Table Definition Manipulation Renaming a table: ALTER TABLE table RENAME new_table Changing a column’s data type: ALTER TABLE table MODIFY column datatype Changing the order of columns: Renaming a column: ALTER TABLE table CHANGE column_name new_column_definition Removing a column: ALTER TABLE table DROP column Deleting an entire table: DROP TABLE table

Querying the Database SELECT columns FROM tables [WHERE CLAUSE]; [ORDER BY CLAUSE]

Querying the Database (cont.) Limit results with WHERE If there is more than one condition, logical operators Like AND or OR are used

Querying the Database (cont.) Specifying the order Join tables together

Querying the Database (cont.) Natural joins Join on Alias

Modifying & Deleting Database Data Use UPDATE command to modify the data USE DELETE command to delete the data

Search Functions Use the LIKE operator The % sign indicates that anything can match The _ sign indicates that exact one character can match

Logical Operators Use AND, OR and NOT operators in WHERE clause

Practice In this practice, you will Create a table named “user” which have following fields ID, integer, PrimaryKey, auto_increment Name, varchar (100) Gender, tinyint (1) , varchar (100) Insert 5 users into the table “user” Create a table named “user_log” which have following fields user_id, integer time_of_login time_of_logout number_of_pages_view Insert login and logout information of 5 users above Find the user detail based on time_of_login or time_of_logout Find the user have the maximum number_of_pages_view Find the user have the maximum login times Practice using the LIKE operator