MySQL Alter Table Statement Exercises: Rename the table countries to country_new
MySQL Alter Table Statement: Exercise-1 with Solution
Write a SQL statement to rename the table countries to country_new.
Here is the list of tables.
+---------------+ | Tables_in_hrr | +---------------+ | countries | | departments | | dup_countries | | employees | | jobs | +---------------+
Code:
ALTER TABLE countries RENAME country_new;
Let execute the above code in MySQL 5.6 command prompt
Now, after execute the command see the list of tables.
+---------------+
| Tables_in_hrr |
+---------------+
| country_new |
| departments |
| dup_countries |
| employees |
| jobs |
+---------------+
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: MySQL Alter Table
Next: Write a SQL statement to add a column region_id to the table locations.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework