MySQL

One great thing about MySQL is that it can be scaled down to support fixed database applications. Maybe it is because of this many people think that MySQL can only handle small and medium-sized systems.

The truth is that MySQL is the de-facto regular database system for web sites with

With PHP, you can connect to and operate databases.

MySQL is the for the most part popular database system used with PHP.

 

What is MySQL?

  • 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
  • MySQL is very fast, reliable, and easy to use
  • MySQL supports average SQL
  • MySQL compiles on a number of platforms
  • MySQL is free to download and use
  • MySQL is developed, distributed, and supported by Oracle Corporation
  • MySQL is named after co-founder Monty Widenius's daughter: My

Create data base 

-------------------------------------------------------

CREATE DATABASE  `School`;

-------------------------------------------------------     

Table structure for Gallery

------------------------------------------------------

 CREATE TABLE IF NOT EXISTS `Gallery` (

`id` int(50) NOT NULL AUTO_INCREMENT,

`head` varchar(100) NOT NULL,

`title` varchar(100) NOT NULL,

`mess` varchar(200) NOT NULL,

`photo_name` varchar(100) NOT NULL,

`date` datetime NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

 

Connection to the MySQL Server

Host :                     Optional. Either a host name or an IP address

Username :             Optional. The MySQL user name

Password :              Optional. The password to log in with

Dbname :                Optional. The default database to be used when performing queries

 

If you use wamp server  5.4 is Default setting below

Host               :      localhost;

Username      :     root;

Password      :     ””;

Dbname        :     Database name  as u define ;

---------------------------------------------------------------------

Create a table for  'Enquery'  use for mysql sentence 

-------------------------------------------------------------------

CREATE TABLE IF NOT EXISTS `enquiry` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`name` varchar(50) NOT NULL,

`father_name` varchar(50) NOT NULL,

`email` varchar(60) NOT NULL,

`mob` varchar(12) NOT NULL,

`city` varchar(50) NOT NULL,

`state` varchar(50) NOT NULL,

`query` varchar(250) NOT NULL,

`date` date NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

 

INSERT INTO Statement

INSERT INTO enquiry (name, father_name, email, mob, city, state, query, date)

VALUES (‘Punit’, ’Shyam’,’punit@gmail.com',  ‘9928654231', ‘Kota’ ‘Rajasthan’ 'Hello', default);

 

UPDATE Example

UPDATE enquiry SET name='Alfred Schmidt', City='Jaipur';

 

DELETE Statement

DELETE FROM enquiry
WHERE name='Alfreds Futterkiste' AND city='kota';

 

Queries

A query is a question or a request.

We can query a database for specific information and have a recorder return.

Look at the following query (using standard SQL):

SELECT  name FROM enquiry

The query above selects all the data in the "name" column from the "enquiry" table.

The data in MySQL is stored in tables. A table is a collection of related data, and it consists of columns and rows.