Home Sql Drop Table



Drop Table
Posted on: December 31, 2008 at 12:00 AM
Drop Table in SQL get rid of an object or table from the database. Using a drop Query get rid of all the rows deleted from the table and the structure is removed from database.

Drop Table

     

Drop Table in SQL get rid of an object or table from the database. Using a drop Query get rid of all the rows deleted from the table and the structure is removed from database. The Drop table cannot get it back, once you run the drop Query for a table.

 Understand with Example

The Tutorial illustrate an example from Drop Table. To grasp this example, we give you a simple demonstrative example to understand Drop Query in SQL. The create table statement create a table 'Stu_Table' with field attribute and data type respectively.

Create Table Stu_Table

SQL statement to create table:

create table Stu_Table(Stu_Id varchar(2), Stu_Name varchar(15), 
Stu_Class  varchar(10), sub_id varchar(2), marks varchar(3));

Insert Data into Stu_Table

The insert into add the records or rows to the  table 'Stu_Table'.

SQL statement to insert data into table:

insert into Stu_Table values(1,'Komal',10,1,45);
insert into Stu_Table values(2,'Ajay',10,1,56);
insert into Stu_Table values(3,'Rakesh',10,1,67);
insert into Stu_Table values(1,'Komal',10,2,47);
insert into Stu_Table values(2,'Ajay',10,2,53);
insert into Stu_Table values(3,'Rakesh',10,2,57);
insert into Stu_Table values(1,'Komal',10,3,45);
insert into Stu_Table values(2,'Ajay',10,3,56);
insert into Stu_Table values(3,'Rakesh',10,3,67);
insert into Stu_Table values(1,'Komal',10,4,65);
insert into Stu_Table values(2,'Ajay',10,4,56);
insert into Stu_Table values(3,'Rakesh',10,4,37);
insert into Stu_Table values(1,'Komal',10,5,65);
insert into Stu_Table values(2,'Ajay',10,5,46);
insert into Stu_Table values(3,'Rakesh',10,5,63);

Stu_Table

Records in the table:

+--------+----------+-----------+--------+-------+
| Stu_Id | Stu_Name | Stu_Class | sub_id | marks |
+--------+----------+-----------+--------+-------+
| 1      | Komal    | 10        | 1      | 45    |
| 2      | Ajay     | 10        | 1      | 56    |
| 3      | Rakesh   | 10        | 1      | 67    |
| 1      | Komal    | 10        | 2      | 47    |
| 2      | Ajay     | 10        | 2      | 53    |
| 3      | Rakesh   | 10        | 2      | 57    |
| 1      | Komal    | 10        | 3      | 45    |
| 2      | Ajay     | 10        | 3      | 56    |
| 3      | Rakesh   | 10        | 3      | 67    |
| 1      | Komal    | 10        | 4      | 65    |
| 2      | Ajay     | 10        | 4      | 56    |
| 3      | Rakesh   | 10        | 4      | 37    |
| 1      | Komal    | 10        | 5      | 65    |
| 2      | Ajay     | 10        | 5      | 46    |
| 3      | Rakesh   | 10        | 5      | 63    |
+--------+----------+-----------+--------+-------+

Drop Table Query

The Drop Table Query delete the table 'Stu_Table' from database. The Table 'Stu_Table' is no longer to be present in database.

Drop Table Stu_Table; 

Related Tags for Drop Table:
sqlcdatabasequerytabledatadeleteobjectstructgetremovestructureusingidtabmoverowforrowsbasedroprunwseitbacknotcanfromceinnoasmtrcaletjemaseallobjacksdelatkisllandannstrssrithstababljemovndonomo


More Tutorials from this section

Ask Questions?    Discuss: Drop Table  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.