sql常用语句格式及例子说明是什么呢?

如题所述

如下:

1、创建表:Create table 表名 ( s_id number(4) ,  s_name varchar2(10) , s_sex char(2) );

2、删除表:Drop table 表名;

3、重命名表名:Rename 旧表名 to 新表名 ;

4、添加列:Alter table 表名 add (  s_age number(3) );

5、删除列:Alter table 表名 drop( S_sex  );

6、查询列表所有信息:Select * from 表名 ;

7、查询一个列表信息(加where条件):Select * from 表名 where s_id = 302。

sql创建后表的修改基础用法

添加列 :基本形式:alter table 表名 add 列名 列数据类型 [after 插入位置]。

 1、在表的最后追加列 address: alter table students add address char(60); 2、在名为 age 的列后插入列 birthday: alter table students add birthday date after age;

修改列 :基本形式:alter table 表名 change 列名称 列新名称 新数据类型;

1、将表 tel 列改名为 telphone: alter table students change tel telphone char(13) default "-";

 2、将 name 列的数据类型改为 char(16): alter table students change name name char(16) not nul。

温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜