mysql常用语句
1.查看所有的数据库
show databases;
2.使用xx数据库
use xx
3.创建xx数据库
create database if not exists `xx`;
4.查看所有的表
show tables;
5.创建xx表
create table if not exists `xx` (
`id` bigint not null AUTO_INCREMENT,
....
`fk_id` bigint not null,
primary key (`id`),
CONSTRAINT `fk1_xx`
FOREIGN KEY (`fk_id`)
REFERENCES `f_xx` (`id`)
ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE=InnoDB default charset=utf8;
6.移除xx表的外键
ALTER TABLE `xx` DROP FOREIGN KEY `fk1_xx`;
7.查看xx表的表结构
7_1.desc `xx`;
7_2.show create table `xx`