MySQL Rename Table In Hindi

📔 : MySQL 🔗

table create होने के बाद अगर आप चाहे तो किसी table को rename भी कर सकते हैं। इसके लिए RENAME command का ही use किया जाता है , और एक साथ कई tables का name भी rename कर सकते हैं।

सबसे पहले देख लेते हैं की हमारे database में tables किस name से हैं -

SHOW TABLES;

Output

+---------------------+
| Tables_in_tutorials |
+---------------------+
| customers           |
+---------------------+
1 row in set (0.001 sec)

MySQL Rename Syntax

table को rename करने का syntax कुछ प्रकार है -

RENAME TABLE
old_table_name1 TO new_table_name1,
old_table_name2 TO new_table_name2
.
.

MySQL Rename Table Example

हम customers table को users नाम से rename करेंगे , ऐसा करने के लिए कुछ इस तरह से command को run किया है -

RENAME TABLE customers TO users;

अगर query का output कुछ इस तरह से है , तो table rename हो चुकी है -

Query OK, 0 rows affected (0.058 sec)

अब अगर आप फिर से tables की listing देखेंगे तो table का name change हुए मिलेंगे।

SHOW TABLES;

Output

+---------------------+
| Tables_in_tutorials |
+---------------------+
| users               |
+---------------------+
1 row in set (0.001 sec)

MySQL Rename Multiple Table

हालाँकि अगर आप चाहें तो, एकसाथ कई tables के name को rename कर सकते हैं -

RENAME TABLE old_table_name1 TO new_table_name1, old_table_name2 TO new_table_name2;

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook

b2eprogrammers