Previous | Home | Next |
DML statements are used to work with the data in tables. SELECT, INSERT, UPDATE, DELETE statements are consider as a DML statement.
- SELECT: SQL server provide the SELECT statement to retrieve data from database. The keywords SELECT, FROM and WHERE makeup the basic SELECT statement . SELECT statement promote the server to querying single table or multiple tables in Database and prepare a result and return to the client application.
- INSERT: The insert statement is used to add new rows to a table. There will need a separate INSERT statement for every row. The statement of Insert will be:
- The number of attributes and the data type of each attribute.
- Character type values are always enclosed in single quotes.
- Number values are never in quote.
- Date values are often in the format 'yyyy-mm-dd' (for example, '2010-12-24').
- UPDATE: The update statement is used to change values that are already in a table.
Selecting Columns
The column name from a table specified in the SELECT statement separated by a comma (,) and there is no need to insert a comma after the last column name.
SELECT column_name 1,column_name 2....column_name n FROM table_name
The above query retrieve the column data which you pass in the query from table which you pass after From keyword.
Selecting All Columns
The SELECT statement used with an asterisk (*) symbol to display all column of the table
SELECT * FROM table_name
INSERT INTO table_name VALUES (value 1, ... value n);
UPDATE table_name SET attribute_name 1 = value 1, attribute_name 2 = value 2....attribute_name n = value n WHERE condition;
If the WHERE clause is omitted, then the specified attribute is set to the same value in every row of the table
Set multiple attribute values at the same time with a comma-delimited list of attribute_name=value pair
The delete statement does just that, for rows in a table.
DELETE FROM table_name WHERE condition
If the WHERE clause is omitted, then every row of the table is deleted
Previous | Home | Next |