• 1.摘要
  • 2.基本信息
  • 3.程序功能
  • 4.常见语句
  • 5.参考资料

sql语句

结构化查询语言

结构化查询语言(Structured Query Language)简称SQL,结构化查询语言是一种数据库查询和程序设计语言,用于存取数据以及查询、更新和管理关系数据库系统;

1/3

sql 语句就是对数据库进行操作的一种语言。

基本信息

  • 中文名

    结构化查询语言

  • 外文名

    Structured Query Language1

  • 选择

    select * from table1 where范围

  • 删除

    delete from table1 where 范围

  • 插入

    insert into table1(field1

  • 接插入

    field2) values(value1,value2)

  • 总数

    select count(*) as totalcount

  • 接总数

    from table1

程序功能

创建数据库

CREATE DATABASE database-name

删除数据库

drop database dbname

创建新表

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

删除新表

drop table tabname

增加一个列

Alter table tabname add column col type

添加主键

Alter table tabname add primary key(col)

删除主键

Alter table tabname drop primary key(col)

创建索引

create [unique] index idxname on tabname(col….)

删除索引

drop index idxname