show databases;显示所有数据库
use test;使用名为test的数据库
show tables;显示test下的表的信息
desc info;显示info表的具体表结构
select * from info; 选择info表中所有内容
insert into info values (1,‘张杰’,17);插入一条信息
insert into info (ID, Name,adrres) values (1,‘张杰’,18);与上面是一样子的
drop from info ;清除表中内容
quit;//退出数据库
create database test;创建名为test的数据库
//
创建名为info的表
create table info(id int , name varchar(20), age int);
drop table info;删除表
//修改表的名字
alter或者rename来实现
alter table old_name rename to new_name
alter table info rename to student; info表改名为student
或rename table old_name to new_name
rename table info to student;
//增加表的字段
alter table table_name add column_name column_type
//修改字段名字
通过命令alter table table_name change column_name new_column_name new_column_name_type
//删除字段
通过命令alter table table_name drop column_name;