sql脚本基础命令

来源:互联网 发布:传奇霸业轮回每层数据 编辑:程序博客网 时间:2024/05/22 10:47

对于表的操作

查询 select * from table_name where conditiaon  group by column1 having condition order by column2>1 (asc,desc) 其中asc为默认。

创建 create table table_name column1 type [not null][not null primery key],column2 type

删除 drop   table_name

修改表结构 alter table table_name alter_sepc;

创建索引 create index index_name on table_name  (col_name(length))

对于语句的操作

插入记录:insert  into table_name values(column1,column2);

修改记录:update  table_name set column1=‘xxx’where condition.

删除记录:delete from table_name where condition;

操作函数:count(),sum(),avg(),max(),min(),distinct

原创粉丝点击