Skip to content

Latest commit

 

History

History
61 lines (49 loc) · 1.57 KB

DML.md

File metadata and controls

61 lines (49 loc) · 1.57 KB

Data Manipulation Language (DML)

  • 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

# Select all the columns:
SELECT *
FROM Employee;
# Select specific columns:
SELECT first_name, last_name
FROM Employee;

INSERT

# 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

# 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';

DELETE

# 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)