Data Manipulation Language (DML)

The Data Manipulation Language (DML) is the most commonly used component of Transact-SQL by database developers. Basically, it is used to retrieve, insert, modify, and delete information from databases. These four operations are performed through the commands that compose the DML, respectively:

  • SELECT

  • INSERT

  • UPDATE

  • DELETE

Therefore, any application or client who wants to interact with SQL Server to retrieve, insert, modify, or delete information has to do it through one of these four elements of the Transact-SQL DML.

Listing 2.8 shows a basic example of each one of the four statements that comprise the Data manipulation language (DML).

Code Listing 2.8. Using the DML to Interact with the Database
					
USE Northwind

INSERT INTO Customers (customerid, companyname, contactname, contacttitle)
VALUES ('ACME1','ACME Publishing','Fernando','DBA')
GO

UPDATE Customers
SET contactname = 'Fernando Guerrero'
WHERE customerid = 'ACME1'
GO

SELECT customerid,companyname
FROM Customers
WHERE customerid = 'ACME1'
GO

DELETE Customers
WHERE customerid = 'ACME1'
GO

(1 row(s) affected)

(1 row(s) affected)

customerid companyname                             
---------- ----------------------------------------
ACME1      ACME Publishing

(1 row(s) affected)

(1 row(s) affected) 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.17.91