SQL DELETE DATABASE

You can easily remove or delete indexes, tables and databases with the DROP statement.

DROP INDEX SYNTAX for MS Access:

DROP INDEX index_name ON table_name

DROP INDEX SYNTAX for MS SQL Server:

DROP INDEX table_name.index_name

DROP INDEX syntax for DB2/Oracle:

DROP INDEX index_name

DROP INDEX syntax for MySQL:

ALTER TABLE table_name DROP INDEX index_name

DROP DATABASE Statement:

DROP DATABASE database_name

Note: We should always note that in RDBMS, database name should be unique.



We should always remember that DROP database command may be the cause of loss of all information so we should always be careful while doing this operation.

We should always remember that DROP database command may be the cause of loss of all information so we should always be careful while doing this operation.

SQL DELETE VIEW

Before knowing about what is SQL delete view, it is important to know -

What is SQL view?

A view is a result set of a stored query on the data.

The SQL view is a table which does not physically exist. It is only a virtual table.

SQL VIEW can be created by a SQL query by joining one or more table.

Syntax for SQL create view -



					CREATE VIEW view_name AS    

SELECT columns   

FROM tables   

WHERE conditions; 

					

If you want to delete a SQL view, It is done by SQL DROP command you should use the following syntax:

SQL DROP VIEW syntax: DROP VIEW view_name Why use the SQL DROP VIEW statement?

When a view no longer useful you may drop the view permanently. Also if a view needs change within it, it would be dropped and then created again with changes in appropriate places.

SQL DELETE JOIN

This is very commonly asked question that how to delete or update rows using join clause

It is not a very easy process, sometimes, we need to update or delete records on the basis of complex WHERE clauses.

There are three tables which we use to operate on SQL syntax for DELETE JOIN.

These tables are table1, table2 and target table.

SQL Syntax for delete JOIN

DELETE [target table]   

FROM    [table1]   

        INNER JOIN [table2]   

ON [table1.[joining column] = [table2].[joining column]   

WHERE   [condition]  

					
Syntax for update

					UPDATE [target table]   

SET [target column] = [new value]   

FROM    [table1]   

        INNER JOIN [table2]   

ON [table1.[joining column] = [table2].[joining column]   

WHERE   [condition]