SQL语句

创建数据库


create database dbName;

  • 如果数据库不存在就创建
create database if not exists dbName;

// 创建db4数据库,判断是否存在,并制定字符集为gbk
create database if not exists db4 character set gbk;

//查询所有数据库名称
show databases;

  • 删除数据库
//删除数据库
drop database dbName;
drop database if exists dbName;
  • 使用数据库
//查询当前正在使用的数据库名称
select database();
//使用数据库
use dbName;

你可能感兴趣的:(SQL语句)