- SQL commands designed to interact with the data stored within database tables.
- The command is not auto-committed (It can't permanently save all the changes in the database) they can be rollbacked.
SELECT | INSERT | UPDATE | DELETE
# Select all the columns:
SELECT *
FROM Employee;
# Select specific columns:
SELECT first_name, last_name
FROM Employee;
# Insert single row:
INSERT INTO Employee(FirstName, LastName, Email)
VALUES('Kirankumar', 'Yadav', '[email protected]');
# Insert multiple rows:
INSERT INTO Employee(FirstName, LastName, Email)
VALUES('Kirankumar', 'Yadav', '[email protected]'),
('Kisankumar', 'Yadav', '[email protected]'),
('Rohit', 'Yadav', '[email protected]'),
('Arpit', 'Yadav', '[email protected]');
# Update the value of a column in a table:
UPDATE Employee
SET Designation = 'Data Scientist'
WHERE FirstName = 'Kirankumar'
AND LastName = 'Yadav'
AND DateOfBirth = '07/02/1996';
# Remove one or more rows from a table:
DELETE
FROM Supplier
WHERE SupplierID = 2;
# WHERE Clause is only used with DELETE command (Not with DROP and TRUNCATE commands)