Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post

SQL DELETE statement

SQL DELETE statement is used to delete the existing records from a RDBMS database table.

Where statement is used to delete specific records.

Syntax:

DELETE FROM table_name
WHERE x_column=x_value



Delete with table join example:

DELETE FROM D
FROM dbo.designation AS D
INNER JOIN MasterDesignation U on U.UserId=D.EmployeeId 
Where DesId=

SQL UPDATE statement

The SQL UPDATE statement is used to update existing records in a RDBMS database table.

You can use where clause to update selected rows only. 

Syntax:

UPDATE table_name
SET column1=value1,column2=value2,...column n=value n
WHERE x_column=x_value;


Practical example with Web application:


Update with table join example:

UPDATE D

SET D.Tilte = U.Title

FROM dbo.designation AS D

INNER JOIN MasterDesignation U on U.UserId=D.EmployeeId  

SQL SELECT statement

Definition:

The SQL SELECT statement returns a result set of records from one or more tables.

Select statement is used to retrieve records from RDBMS Database one or more tables.

Syntax:

SELECT column_name1,column_name2..column n
FROM table_name


Practical example with web application:


Example with multiple tables:

SELECT TITLE,UserName,[Description]
FROM designation D
INNER JOIN UserProfile U on U.UserId=D.Employee