Dropping a table

 In this lesson we are going to study about how to drop a table.
  • Drop table  removes the table and all its data from the database entirely.
  • Drop table is different from deleting all records from the table .
  • Deleting all of the records in the table leaves the table including column and constraint information .
  • Dropping the table removes the table definition as well as all of its rows.
Syntax:

DROP TABLE Table_name;

   In this syntex drop table is the keyword and the table name specify the name of table to be droped.

Example:  Drop the temp_employees table

drop table temp_employees.

Related article:
 I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebooktwitter

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends:

Copying Data

In this lesson we are going to study about how to copy a data from one table to another table.

Syntex:

Insert into Table_name (column1,column2,....,columnN)  Subquery

here insert is a keyword and into specify the table in which we are going to insert the data and Table_name specify the name of the table ,column1,column2,...,columnN is the name of columns.

Example:

Consider a table : departments.



Now we have created a table: dept with same columns.

create table dept
(id number(7),
name varchar2(25)
)


   We can copy the rows in a insert statement.here we are going to insert the data in newly create dept table from the table departments

insert into dept (id,name)
(select department_id as id,department_name as name
from departments)


   In this insert statement we have written a select statement as subquery.In the select statement we have selected the department_id and given the alias name id,and department_name with alias name name.


I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebooktwitter

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends: