1.添加字段: alter table  表名  add (字段  字段类型)  [ default  '输入默认值']  [null/not null]  ; 2.添加备注: comment on column  库名.表名.字段名 is  '输入的备注';  如: 我要在ers_data库中  test表 document_type字段添加备注  comment on column ers_data.test.document_type is '文件类型'; 3.修改字段类型: alter…
在工作中常遇到要维护数据库表的列,这里主要介绍sql语句中的ALTER TABLE 语句.ALTER TABLE 语句用于在已有的表中添加.修改或删除列. 如需在表中添加列,请使用下列语法: ALTER TABLE table_name ADD column_name datatype 要删除表中的列,请使用下列语法: ALTER TABLE table_name DROP COLUMN column_name 注释:某些数据库系统不允许这种在数据库表中删除列的方式 (DROP COLUMN c…
1.在pl/sql中打开cmd命令容器 2.在cmd命令窗口中输入:explain plan for select * from t; 3.查看sql语句的执行计划:select * from table(dbms_xplan.display); MISSES IN library cache during parse:1 翻译:发生在解析的硬解析数量为1,表示硬解析 MISSES IN library cache during parse:0 翻译:发生在解析的硬解析数量为0,表示没有硬解析,…
sql语句 create table AAAATest as select rownum as cardNo, 'test' creator, to_char(sysdate + rownum//, 'yyyy-mm-dd hh24:mi:ss') as dueDate, password, productId, 'ONSELL' status from dual connect by level <= ; level :表示要生成记录量 参考:https://blog.csdn.net/yzs…
一.用户及权限(DBA有最高系统权限) 1.数据库的安全性:系统的安全性.数据的安全性 2.权限分类: 2.1系统权限:获得后可访问数据库 常用的有create table,create user,create views,create session 2.2对象权限:操作数据库对象的内容 Select  insert  update  delete 3.权限的使用 3.1授予系统权限 grant 系统权限 to 用户 [with admin option] with admin option…
第一种: 在PL/SQL中,在Explain plan Window中执行要优化的Sql语句.结果,如下图: Object name列中显示了命中的索引名,Cost列显示了CPU的使用率(%). 第二种: 使用Explain plan for 命令. 1.执行 “explain plan for  要执行的Sql语句;” 2.执行 “select * from table(DBMS_XPLAN.display);”查看结果.如下图…
1.update 表名 set 表字段=(select 另一个表中的相同字段 from 另一个表表名 where 表.字段=另一个表.字段) where  表.字段=? 例子:将某个表中的更新到另一个表中 update psp_model  m set m.mp_id=(select mp_id from psp_c_mp mp where p.mp_no=mp.mp_no) where  m.mp_no=? 2.insert into 表名  m(mp_id,mp_name,mp_no,org…
在PL/SQL Developer中编写sql语句时,如果无法自动提示字段那是一件痛苦的事情,工作效率又低,在此演示下如何在PL/SQL Developer工具中自动提示字段,让开发者省时又省心,操作步骤如下:tools–>preferences–>user interface–>code assistant–>在右边选中authomatically activated即可,如…
MySQL中执行sql语句错误 Error Code: 1093. You can't specify target table 'car' for update in FROM clause 2017年03月21日 11:32:46 回归心灵 阅读数:686   版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u010657094/article/details/64439486 当执行以下sql语句时会出现 Error Code:1093 错…
eclipse中原sql: 异常: 原因:Eclipse中的SQL语句不能加分号 去掉分号,正常执行,插入成功. 这里把id设为了主键,具有唯一性,重复插入同一id执行插入失败,ORA-00001号错误.…