MySQL CREATE table

Source: Internet
Author: User

MySQL is used for the first time, simply record some of the common commands used in this project

Start MySQL under 1.win

Open the command line and enter:

Mysql-uroot-p

2. Enter the command show databases;

Select the operational database for the build table use Sina_blog

Build table named Class_list
Change the primary key ID to name
ALTER TABLE class_list Change ID name mediumint (8) auto_increment
CREATE TABLE  int(one notNULLPRIMARYKEYvarchar (255varchar(),countint(  One ))

. Create a federated primary key:

CREATE TABLEarticle_list (IDvarchar( -) not NULL, titlevarchar(255), URLvarchar(255), class_idint( One) not NULL, Created_timeint( One),PRIMARY KEY(id,class_id));

. When modified: ALTER TABLE Tb_name add primary key (Field 1, Field 2, Field 3);

MySQL CREATE table

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.