PHP

Basic Database Operation


 

The most common basic database operations are Data Manipulation Language (DML) commands in SQL which are used to manage and manipulate data stored in a database.

DML operations are:

  1. SELECT Command
  2. INSERT Command
  3. UPDATE Command
  4. DELETE Command

 

1. SELECT Command:

Retrieves data from one or more tables.

 

Syntax:

SELECT column1, column2, ...
FROM table_name
WHERE condition;


2. INSERT Command:

Adds new records to a table.

 

Syntax:

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

 

3. UPDATE Command:

Modifies exits records in a table.

 

Syntax:

UPDATE table_name 
SET column1 = value1, column2 = value2,... 
Where Condition;

 


4. DELETE Command:

Removes records from a table

 

Syntax:

DELETE FROM table_name
WHERE condition;

 

These commands are fundamental for managing the data within a relational database. Keep in mind that proper use of these commands is crucial to maintaining data integrity and consistency within the database.