1.sql语句中的 is null 和 is not null 是测试列值是否为空和非空。is null 对应的是数据库中的值为空,就是没有数据,这里的null不是表里实际的值null。
比如:
select * from cars --cars表中的所有记录
select * from cars where carname is null --为空的记录
select * from cars where carname is not null --不为空的记录
2. 数据定义的关键字有create、alter、drop,下面主要说明alter:
添加新的列:
--alter table tablename add 列名 列类型
alter table cars add carprice number(10) --没有column关键字
修改列的类型及约束条件:
--alter table 表名 modify (列名 约束条件)
alter table cars modify (carname not null)
alter table cars modify (carname varchar2(50))
删除列名:
--aleter table 表名 drop column 列名
alter table cars drop column carprice
对列名重新命名:
alter table cars rename column carprice to car_price
--oracle是9.2以上才能直接使用