DML - Insert Data into a table
• Syntax :
– INSERT INTO table_name VALUES
(value1,value2,value3,...);
• Example:
– INSERT INTO Customers (CustomerName, City, Country)
VALUES (baabtra', ‘Calicut', ‘India');
• Note : String and date values are specified as quoted string.
Also with insert you can insert NULL directly to represent a
missing value.
DML - Insert Data into a table
DML -Retrieving information from a table
The SELECT statement is used to pull data from a table”
Syntax:
– SELECT what_to_select FROM table_name Where
conditions_to_satisfy ;
What_to_select indicates The Where clause is optional.
what you want to see. This If it is present,
can be a list of columns or * conditions_to_satisfy
to indicate “all columns”. specifies one or more
conditions that rows must
satisfy to qualify for retrieval.
DML - Example
• Select * from person;
• Select id,firstname from person;
• Select * from person where city=‘banglore’
SQL Server ALIASES
• SQL aliases are used to give a table, or a column in a
table, a temporary name.
• Aliases are often used to make column names more
readable.’
DML - Update Query
• Syntax:
• UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;
• Example:
• UPDATE Customers
SET ContactName=‘Alex', City=‘calicut'
WHERE CustomerName=‘baabtra';
DML - Update Query
Delete Query
• Syntax:
– DELETE FROM table_name
WHERE some_column=some_value;
• Example :
– DELETE FROM Customers
WHERE CustomerName=‘baabtra' AND
ContactName='Maria';