Mysql数据库语句大全

1、说明:创建数据库

CREATE DATABASE database-name

2、说明:删除数据库

drop database dbname

3、说明:备份sql server
— 创建 备份数据的 device

USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'

— 开始 备份

BACKUP DATABASE pubs TO testBack

4、说明:创建新表

create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..)

根据已有的表创建新表:

A:create table tab_new like tab_old (使用旧表创建新表)
B:create table tab_new as select col1,col2… from tab_old definition only

5、说明:删除新表

drop table tabname

6、说明:增加一个列

Alter table tabname add column col type

猜你喜欢

转载自blog.csdn.net/u013257111/article/details/51881366