Create a table in MySQL and create a table in mysql

Source: Internet
Author: User

Create a table in MySQL and create a table in mysql

-- Create DATABASE test
Use test;

Drop table if EXISTS zones;
Create table zones
(
Z_id int primary key auto_increment,
Z_name VARCHAR (50) NOT NULL
) ENGINE = INNODB;

Drop table if exists user_info;
Create table user_info
(
'User _ id' INT,
'Email 'VARCHAR (50 ),
'Pwd' VARCHAR (50) not null,
'Uname' VARCHAR (50 ),
'Zone 'int not null,
'Age' INT,
'Create _ time' datetime not null,
Primary key ('user _ id', 'email '),
Foreign key (zone) REFERENCES zones (z_id)
) ENGINE = INNODB;

-- Drop table if exists 'user _ info ';
-- Create table 'user _ info '(
-- 'User _ id' int (11) not null,
-- 'Email 'varchar (50) not null,
-- 'Pwd' varchar (50) not null,
-- 'Uname' varchar (50) default null,
-- 'Zone 'int (11) not null,
-- 'Age' int (11) default null,
-- 'Create _ time' datetime not null,
-- Primary key ('user _ id', 'email ')
--) ENGINE = MyISAM default charset = utf8;

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.