Mysql tutorial

download Mysql tutorial

of 148

  • date post

    12-Feb-2017
  • Category

    Documents

  • view

    413
  • download

    3

Embed Size (px)

Transcript of Mysql tutorial

  • MySQL Tutorial

  • i

    MYSQL TUTORIAL

    Simply Easy Learning by tutorialspoint.com

    tutorialspoint.com

  • TUTORIALS POINT Simply Easy Learning

    ABOUT THE TUTORIAL

    MySQL Tutorial MySQL is the most popular Open Source Relational SQL database management system. MySQL is one of the best RDBMS being used for developing web-based software applications.

    This tutorial will give you quick start with MySQL and make you comfortable with MySQL programming.

    Audience This reference has been prepared for the beginners to help them understand the basics to advanced concepts related to MySQL languages.

    Prerequisites Before you start doing practice with various types of examples given in this reference, I'm making an

    assumption that you are already aware about what is database, especially RDBMS and what is a computer programming language.

    Copyright & Disclaimer Notice

    All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws.

    This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy of the site or its contents including this tutorial. If you discover that the tutorialspoint.com site or this tutorial content contains some errors, please contact us at webmaster@tutorialspoint.com

    htt://www.tutorialspoint.com/htt://www.tutorialspoint.com/file:///C:/Users/ZARA/Desktop/webmaster@tutorialspoint.com

  • TUTORIALS POINT Simply Easy Learning

    Table of Content MySQL Tutorial ........................................................................ 2 Audience .................................................................................. 2 Prerequisites ............................................................................ 2 Copyright & Disclaimer Notice .................................................. 2 Introduction ............................................................................ 12 RDBMS Terminology:............................................................................... 12

    MySQL Database: .................................................................................... 13

    Before You Begin: .................................................................................... 13

    Installation .............................................................................. 14 Installing MySQL on Linux/UNIX .............................................................. 14

    Installing MySQL on Windows: ................................................................. 15

    Verifying MySQL Installation: ................................................................... 15

    Use the mysqladmin Utility to Obtain Server Status: ................................ 15

    Execute simple SQL commands using MySQL Client: ............................. 15

    Post-installation Steps: ............................................................................. 16

    Running MySQL at boot time: .................................................................. 16

    Administration ........................................................................ 17

    The /etc/my.cnf File Configuration: ........................................................... 19

    Administrative MySQL Command: ........................................................... 19

    PHP Syntax ........................................................................... 20 Connection ............................................................................. 21

    Example: .................................................................................................. 21

    MySQL Connection using PHP Script: ..................................................... 21

    Syntax: ..................................................................................................... 21

    Syntax: ..................................................................................................... 22

    Example: .................................................................................................. 22

    Create Database .................................................................... 24 Example: .................................................................................................. 24

    Create Database using PHP Script: ......................................................... 24

    Syntax: ..................................................................................................... 24

    Example: .................................................................................................. 24

    Drop Database ....................................................................... 26 Drop Database using PHP Script: ............................................................ 26

    Syntax: ..................................................................................................... 26

    Example: .................................................................................................. 27

    Select Database ..................................................................... 28 Selecting MySQL Database from Command Prompt: .............................. 28

    htt://www.tutorialspoint.com/htt://www.tutorialspoint.com/

  • TUTORIALS POINT Simply Easy Learning

    Example: .................................................................................................. 28

    Selecting MySQL Database Using PHP Script: ........................................ 28

    Syntax: ..................................................................................................... 28

    Example: .................................................................................................. 29

    Data Types ............................................................................ 30 Numeric Data Types:................................................................................ 30

    Date and Time Types: .............................................................................. 31

    String Types: ............................................................................................ 31

    Create Tables ........................................................................ 32

    Syntax: ..................................................................................................... 32

    Creating Tables from Command Prompt: ................................................. 32

    Example: .................................................................................................. 33

    Creating Tables Using PHP Script: .......................................................... 33

    Example: .................................................................................................. 33

    Drop Tables ........................................................................... 35 Syntax: ..................................................................................................... 35

    Dropping Tables from Command Prompt: ................................................ 35

    Example: .................................................................................................. 35

    Dropping Tables Using PHP Script: ......................................................... 35

    Example: .................................................................................................. 35

    Insert Query ........................................................................... 37 Syntax: ..................................................................................................... 37

    Inserting Data from Command Prompt: .................................................... 37

    Example: .................................................................................................. 37

    Inserting Data Using PHP Script: ............................................................. 38

    Example: .................................................................................................. 38

    Select Query .......................................................................... 40 Syntax: ..................................................................................................... 40

    Fetching Data from Command Prompt: .................................................... 40

    Example: .................................................................................................. 40

    Fetching Data Using PHP Script: ............................................................. 41

    Example: .................................................................................................. 41

    Example: .................................................................................................. 42

    Example: .................................................................................................. 42

    Releasing Memory: .................................................................................. 43

    Example: .................................................................................................. 43

    Where Clause ........................................................................ 44 Syntax: ..................................................................................................... 44

    Fetching Data from Command Prompt: .................................................... 45