MySQL table defines the operation

Source: Internet
Author: User

1. Create database create database lush;2. Delete Database drop database lush;3. Select the database use lush;4. Create user Grant  all on *.* to  ' lush ' @ '% '  identified by  ' 123456 '; 5. CREATE TABLE create  Table zhu (Id int,name varchar (20)); Delete table drop table zhu;6. View table Structure desc zhu;7. Insert Data insert into zhu values (1, ' Zhang3 '), (2, ' li4 '); 8. View Data select * from zhu;9. Modify Table Alter table zhu modify name varchar (Alter table zhu change);  name name varchar (88); 10. Add Column Alter table zhu add column age int (2 ); 11. Delete Column alter table zhu drop id;12. Name the rename Alter table zhu change name  myname varchar (two); #change和modify都可以修改表的定义, it is inconvenient to write the name of the column after the change, but the advantage of changes can modify the names of the columns, modify is not. 13. While adding a column, specify where the column is located in the table Alter table zhu add id int (5)  first;alter table  Zhu add id1 int (5)  after myname;14. Renaming the table alter table zhu rename zhuzhu; 

This article from "Wave Scouring sand" blog, declined reprint!

MySQL table defines the operation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.