devonmanelski.com |
  |
Home | I.T. Management | Business Analysis & Project Management | VB.Net | SQL Server | About | |
Structured Query Language (SQL) is a Query Language that is used to retrieve, add, update and delete records from a Relational Database Management System (RDBMS). Within SQL there are two main types of statements: Data Definition Language (DDL) and Data Manipulation Language (DML) Statements. This article focuses on Data Manipulation Language (DML). There are four main commands in Data Manipulation Language (DML): SELECT, INSERT, UPDATE and DELETE. These commands can affect one to many rows in a Database.
SQL Data Types
INSERT INTO Table_Name (FieldName1, FieldName2, FieldName3) VALUES (FieldValue1, FieldValue2, FieldValue3)
INSERT INTO [Customers] ([Company], [Last Name], [First Name], [City]) VALUES ('Software Startup Company', 'Jason', 'Smith', 'San Francisco')
This example is for the Customers Table of Microsoft's Northwind Sample Database.
UPDATE Table_Name SET FieldName2 = FieldValue2, FieldName3 = FieldValue3, FieldName4 = FieldValue4 WHERE FieldName1 = Numeric, String or DateTime Value
UPDATE [Customers] SET [Company] = 'Software Engineering Company', [City] = 'Kansas City' WHERE [ID] = 1
This example is for the Customers Table of Microsoft's Northwind Sample Database. The ID Value is set by the AutoNumber ID field after the record is inserted into the Customers Table.
DELETE FROM Table_Name WHERE FieldName1 = Numeric, String or DateTime Value
DELETE FROM [Customers] WHERE [ID] = 1
This example is for the Customers Table of Microsoft's Northwind Sample Database. The ID Value is set by the AutoNumber ID field after the record is inserted into the Customers Table.