0% found this document useful (0 votes)
7 views8 pages

SQL DML: Insert, Select, Update, Delete

The document provides an overview of Data Manipulation Language (DML) operations in SQL, including syntax and examples for inserting, selecting, updating, and deleting data in tables. It highlights the use of aliases for readability and specifies how to handle string and date values. Additionally, it explains the optional WHERE clause in SELECT statements for data retrieval based on conditions.

Uploaded by

marwa.mah1956
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views8 pages

SQL DML: Insert, Select, Update, Delete

The document provides an overview of Data Manipulation Language (DML) operations in SQL, including syntax and examples for inserting, selecting, updating, and deleting data in tables. It highlights the use of aliases for readability and specifies how to handle string and date values. Additionally, it explains the optional WHERE clause in SELECT statements for data retrieval based on conditions.

Uploaded by

marwa.mah1956
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

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

You might also like