Free WebSchools.com

Google


Blog ForumsLive chat WebhostingLink TO UsSEO ToolsResources


HOME

MYSQL

MYSQL Introduction
MYSQL Table Create
MYSQL Retrive
MYSQL Insert

MYSQL Delete
MYSQL Update
MYSQL Sort



MYSQL Insert







You have understood select Statement now we will see how to insert that data into the database As it is name suggest INSERT is used to insert (add) rows to a database table insert can be used in several ways

Inserting a full single row

Inserting single partial row

Inserting the results of a query

Inserting complete rows

The simplest way to insert data into a table is to use the basic INSERT syntax, which requires table name and the values to be inserted into a new row.

Here is the example

INSERT into student values (‘hari’,’10’,’98’);
The meaning of the above statement
INSERT into student values (‘name’,’age’,’marks’);


The above example inserts a new student into a student table. Although the syntax is simple but is not the safe methods. The above SQL statement is highly dependent on the order in which the columns are defined in the table. The safer way to write the INSERT Statement is as follows

Insert into student (student_name,student_age,student_marks) values (‘hari’,’10’,’98’);



What is SQL?

SQL is an abbreviation for Structured Query Language. SQL is a language designed mainly for communicating with databases. SQL is easy to learn. The statements are all made up of descriptive English word. SQL is designed to do only one work that is communicating with database in a simple and efficient way.