SQLtable program

Rajeev Ranjan Tiwari

SQL - DROP TABLE

DROP TABLE Statement का इस्तेमाल बनाये हुए table को delete करने के लिये किया जाता है |

Syntax for DROP TABLE Statement

DROP TABLE table_name;

Example for DROP TABLE Statement in SQL

Example पर 'mytable' नाम के table को delete किया गया है |

Source Code :
DROP TABLE mytable;

 SQL - TRUNCATE TABLE

TRUNCATE TABLE Statement का इस्तेमाल दिए गए table के data को delete करने के लिए किया जाता है |

इस Statement से table को delete नहीं किया जाता है |

Syntax for TRUNCATE TABLE Statement

TRUNCATE TABLE table_name;

Example for TRUNCATE TABLE Statement in SQL

Example पर 'mytable' नाम के table के data को delete किया गया है |

Source Code :
TRUNCATE TABLE mytable;

 SQL - Create Table From Existing

अगर Existing table के columns और data किसी दुसरे new table में copy करने के लिए CREATE Statement के साथ SELECT Statement का इस्तेमाल किया जाता है |

Syntax for Creating Table From Existing Table in SQL

CREATE TABLE old_table AS
SELECT column_name(s)
FROM mytable;

Sample Table 'mytable'

+------+------------+-----------+
| id   | first_name | last_name |
+------+------------+-----------+
|    1 | Akshay     | Korke     |
+------+------------+-----------+

Example for Creating Table From Existing Table in SQL

Example पर mytable का सभी data; mytable1 इस table को create करके उसमे copy किया गया है |

Source Code :
CREATE TABLE mytable1 AS
SELECT * 
FROM mytable;
Output :
Query OK, 1 row affected (0.40 sec)
Records: 1  Duplicates: 0  Warnings: 0

Table 'mytable1'

+------+------------+-----------+
| id   | first_name | last_name |
+------+------------+-----------+
|    1 | Akshay     | Korke     |
+------+------------+-----------+
Thanks friend posted by Rajeev Ranjan Tiwari

Comments

Popular posts from this blog

OT Technician

D Pharma

Tor Browser