Mysql review and learning (2) create and delete databases and table structures _ MySQL

Source: Internet
Author: User
Mysql review and learning (2) database and table structure creation and deletion bitsCN.com

Mysql-h localhost-uroot-p123456 // connect to the database

Show databases; // view the database

Create database if not exists db_goods; // create a database

Use db_goods; // use the database

Show tables; // view tables in the database

Create table goods (id int, name varchar (10); // create a table

Desc goods; // view the tag structure

Insert into goods (id, name) values ('1', 'hangsan'); // insert data into the table

Update goods set name = 'lisi', id = '3' where id = '1'; // update data

Delete from goods where id = '1'; // delete data

Drop table if exists goods; // delete a table

Drop database if exists db_goods; // delete a database

? Contents; // view help

? Create table; // view the Help for creating a table

BitsCN.com

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.