表结构操作
添加表字段
alter table tableName add (address varchar2(32) default '无',country varchar2(32) default ''); --给表添加 address 和 country字段 都是32位长度的字符串类型
删除表字段
alter table tableName drop column country; --删除表的country字段
表数据操作
sql表的设计是很重要的,涉及业务与拓展及后期维护,但是核心应该是:简单
查询表内容
select * from tableName; --查询表所有内容
select name,age from tableName; --查询表name字段和age字段
查询总数
select count(1) from tableName; -- 不统计 null
select count(*) from tableName; -- 统计 null
按条件查询 where
select * from tableName where age >= 18; --查询表中age大于18的所有数据
插入数据
insert into tableName(field1,field2) values('value1','value2');
提交
commit