Learning MySQL 1 - create database & tables using specified charset
来源:互联网 发布:昆仑健康保 知乎 编辑:程序博客网 时间:2024/05/16 03:14
1 Create Databases
create database mydb DEFAULT CHARSET=utf8;
2 Create Tables
create table ids ( id int auto_increment, name varchar(10) not null, num varchar(10), description text, primary key (id, name), -- not primary key (name, id) : ordered by fields defination key `num` (`num`)) ENGINE=InnoDB default charset=utf8;create table ref ( sno varchar(10), foreign key (sno) references ids(num) on update cascade on delete cascade) ENGINE=InnoDB default charset=utf8;
注意:
(1) primary(field1, field2, ...)字段必须按照表中定义时的字段顺序,否则出错;
(2) 若表的一个字段(ref表的sno)是外引用,即引用另一个表的一个字段(ids表的num),那么被引用的字段(ids表的字段num)必须建立索引(key `index_name` (`num`));
(3) 若一个字段(ids表的id字段)是auto_increment型的,那么这个字段必须是定义为键(primary key);
(4) 反撇号`作用于表名、字段名;
- Learning MySQL 1 - create database & tables using specified charset
- mysql create database utf8
- mysql的create database
- mysql create database
- LeetCode database using mysql
- MySQL Primer--Create Database,Create Table
- mysql create database
- create table of mysql database
- MySQL权限篇之CREATE TEMPORARY TABLES
- Using CREATE TABLE AS SELECT (CTAS) to Reorganize Oracle Tables
- Lesson10 Using DDL Statements to Create and Manage Tables
- create tables.
- CREATE DATABASE IF NOT EXISTS game DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
- Using a Custom Action to Create a Database During Installation
- Using a Custom Action to Create a Database During Installation
- Using a Custom Action to Create a Database During Installation
- Using a Custom Action to Create a Database During Installation
- Using a Custom Action to Create a Database During Installation
- JavaSE第六讲:流程控制语句 Flow Control Statement
- 黑马训练营-学习笔记----JavaIO
- SQL中邮箱的格式
- 你可能不知道的10个图标搜索引擎
- vc++对文件的读取,写入操作
- Learning MySQL 1 - create database & tables using specified charset
- 常用正则表达式整理
- 第一个MapBasic程序(插件) 路径检查
- 杂记之C语言之指针(二)
- C++第11周项目4——大奖赛计分
- 黑马训练营-学习笔记----图形用户界面
- ip classless
- cocos2d-x中带光标的输入框(CCTextFieldTTF)(这个不完善,后期再继续研究)
- 表单的多种提交方式