22 August 2010

0 CRUD operations in MySQL Database

CRUD operations

CRUD is the acronym for Create, Read, Update and Delete. Create, Read, Update and Delete (CRUD) are the 4 basic functions of a Database or persistent storage. CRUD refers to all of the major functions that need to be implemented in a RDBMS.
Each letter in the CRUD can be mapped to a standard SQL statement:

Create        INSERT
Read        SELECT
Update        UPDATE
Delete        DELETE

CRUD operations in MySQL Database

Insert Data Into MySQL Database Table

The INSERT INTO statement is used to add new records to a database table.

Syntax

It is possible to write the INSERT INTO statement in two forms.

The first form doesn't specify the column names where the data will be inserted, only their values:

INSERT INTO table_name
VALUES (value1, value2, value3,...)

The second form specifies both the column names and the values to be inserted:

INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)

Select Data From MySQL Database Table

The SELECT statement is used to select data from a database.

Syntax

SELECT column_name(s)
FROM table_name

Update Data In MySQL Database Table

The UPDATE statement is used to update existing records in a table.

Syntax

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value

Delete Data from MySQL Database Table

The DELETE FROM statement is used to delete records from a database table.

Syntax

DELETE FROM table_name
WHERE some_column = some_value


0 comments:

Feeds Comments

Please give your valuable comments.