随笔分类 - 11 【数据库技术_综合】
摘要:mysql中MyISAM和InnoDB存储引擎都支持外键(foreign key),但是MyISAM只能支持语法,却不能实际使用。下面通过例子记录下InnoDB中外键的使用方法:创建主表:mysql> create table parent(id int not null,primary key(id)) engine=innodb;Query OK, 0 rows affected (0.04 sec)创建从表:mysql> create table child(id int,parent_id int,foreign key (parent_id) references par
阅读全文
摘要:常用数据库语法(以Mysql为基础)注:我们以XXX代表数据库名(database),aaa代表数据表名(table),id和name为列名(column)DOS下连接数据库:mysql -u用户名 -hIP-p密码备份(前提是以断开数据库连接):mysqldump -u用户名 -p密码 数据库名 >F:\XXX.txt恢复:mysql -u用户名 -p密码 数据库名 <F:\XXX.txt数据库操作:create database XXX;show databases;use XXX;drop database XXX;表操作:1.创建create————————————————
阅读全文