DATA MANIPULATION LANGUAGE
(DML)
SELECT:-
SELECT statements or commands are used to
retrieve or select data from the table.
Syntax: 1
SELECT * from
Table_name; |
Example:
SELECT * from new_books;
Purpose:-
This statement used to select all columns from
the specified table.
Syntax:2
SELECT
column_name_1,column_name_2,....column_name_n from Table_name; |
Purpose:-
This statement used to select particular
columns from the specified table.
Example:
SELECT book_no ,book_name, author_id , price
from new_books;
INSERT:-
The INSERT command is used for inserting one
or more rows into a database table with specified table column values.
INTO is the keyword for the INSERT statement.
Syntax:
INSERT INTO
table_name (column1, column2, column3, ...) VALUES (value1, value2, value3,
...); |
Example:
INSERT INTO table_name (book_no,book_name,
author_id, ...) VALUES (1234, 'The Sql concepts' ,67895, ...);
UPDATE:-
The UPDATE statement is used to modify the
existing records in a table.
SET is the keyword for the UPDATE statement.
Syntax:
UPDATE table_name
SET column1 = value1, column2 = value2, ... WHERE condition; |
Example:
UPDATE new_books SET book_no = 1235, book_name
= 'The SQl Applications and Its uses' WHERE author_id=67895;
DELETE:-
The DELETE statement removes one or more
records from a table.
Syntax:
DELETE FROM
table_name WHERE condition; |
Example:
DELETE FROM new_books
WHERE author_id=67895;