当前位置: 移动技术网 > IT编程>数据库>Mysql > create table,show tables,describe table,DROP TABLE,ALTER TABLE ,怎么使用?

create table,show tables,describe table,DROP TABLE,ALTER TABLE ,怎么使用?

2018年12月07日  | 移动技术网IT编程  | 我要评论

2)表本身(非表数据)的基本操作: 

create table 表名 (列_1_名 列_1_类型 列_1_细节,
     列_2_名 列_2_类型 列_2_细节,
    ...   
    );
例如:create table student(id int not null,name char(10),age int);
例如:create table t (id int not null, last_name char(30) not null, first_name char(30) not null, d date not null);

show tables;显示当前数据库中的tables
describe table_name;显示table各字段信息
drop table t; (删除表)
drop table t1, t2, t3;
alter table t add x int not null;(增加一列)
alter table t drop x; (删除y)

3)表数据的基本操作:

添加纪录:
insert into 表名 (列_list) values (值_list);

例如:
insert into student (id,name,age) values(1,'liyaohua',25);

insert into student (id,name,age) values(2,'fuwenlong',26);

详情请见:

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网