You are on page 1of 2

DML Queries

DML (Data Manipulation Language) queries are used to manipulate data stored in a
database system. These queries are used to perform various operations on data
such as inserting, updating, deleting, and retrieving data. Here are some common
DML queries:

SELECT: This query is used to retrieve data from a database table. It can be used to
retrieve all the rows and columns from a table or select specific columns and rows
based on certain conditions.
Query: SELECT * FROM students;

INSERT: This query is used to insert data into a database table. It requires specifying
the table name and the values to be inserted.
Query: INSERT INTO students (name, email, phone) VALUES (Fahad Hussain,
info.fahadjalbani@gmail.com, '123-456-7890');

UPDATE: This query is used to update existing data in a database table. It requires
specifying the table name, the columns to be updated, and the new values.
Query: UPDATE students SET name = 'Fahad Hussain' WHERE id = 1;

DELETE: This query is used to delete data from a database table. It requires
specifying the table name and the rows to be deleted based on certain conditions.
Query: DELETE FROM students WHERE id = 1;

SQL STATEMENT
SQL (Structured Query Language) is a standard language used for managing
relational databases. Here are some basic SQL statements:

SELECT statement: It is used to retrieve data from a database.


SELECT column_name(s) FROM table_name;

INSERT statement: It is used to insert new data into a table.


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

UPDATE statement: It is used to modify existing data in a table.


UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;

DELETE statement: It is used to delete data from a table.


DELETE FROM table_name WHERE condition;

CREATE statement: It is used to create a new table in a database.


CREATE TABLE table_name (

column1 datatype,

column2 datatype,

column3 datatype,

....);

You might also like