Home > Database > Mysql Tutorial > body text

mysql 建数据库 建表_MySQL

WBOY
Release: 2016-06-01 13:51:52
Original
1091 people have browsed it
创建数据库:create database td character set =utf8;use database td;//在数据库td中创建表
Copy after login
create table tb_student (<br>Student_ID int auto_increment primary key, <br>Student_Name varchar(20), <br>Sex char(1), <br>Birthday varchar(10)<br>) engine=innodb default character set =utf8 auto_increment =100;//指定存储引擎和字符集  create table tb_subject (<br>Subject_ID int auto_increment primary key, <br>Subject_Name varchar(50)<br>) engine=innodb default character set =utf8;<br><br>create table tb_score (<br>ID int auto_increment primary key,<br>Student_ID int,<br>Subject_ID int,<br>Score decimal(10,2),<br>foreign key (Student_ID) references tb_student(Student_ID),//外键<br>foreign key (Subject_ID) references tb_subject(Subject_ID)<br>) engine=innodb default character set =utf8;
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!