describe employees;
=
select column_name,data_type,nullable,data_length,data_
precision,data_scale from user_tab_columns where table_
name='EMPLOYEES';
create table employees_copy as select * from employees;
select * from emp_dept where rownum < 10;
create table no_emps as select * from employees where 1=2;
■Adding columns(增加列):
alter table emp add (job_id number);
■ Modifying columns(修改列):
alter table emp modify (comm number(4,2) default 0.05);
alter table author add (
author_last_published date default SYSDATE,
author_item_published varchar2(40)
default 'Magazine Article' not null
);
alter table POOR."SUBADMREQUEST" MODIFY ("ACCORDDISEASEKINDRANGE" VARCHAR2(1000 CHAR) );
■ Dropping columns(删除列):
alter table emp drop column comm;
■ Marking columns as unused(标注列不再使用):
alter table emp set unused column job_id;
■ Renaming columns(重命名列):
alter table emp rename column hiredate to recruited;
■ Marking the table as read-only(标注表只读):
alter table emp read only;
--select * from NLS_SESSION_PARAMETERS;
ALTER SESSION SET NLS_DATE_FORMAT = 'yyyy-mm-dd HH24:mi:ss';
alter system set nls_date_format='yyyy-mm-dd HH24:mi:ss' scope=spfile;
select 'DATABASE', value
from nls_database_parameters
where parameter = 'NLS_DATE_FORMAT'
union
select 'INSTANCE', value
from nls_instance_parameters
where parameter = 'NLS_DATE_FORMAT'
union
select 'SESSION', value
from nls_session_parameters
where parameter = 'NLS_DATE_FORMAT';
永久设置日期时间格式:In Windows, add NLS_DATE_FORMAT in environment variable:
我的电脑 属性 高级 环境变量 新建 变量名 NLS_DATE_FORMAT 变量值 YYYY-MM-DD HH24:MI:SS 应用 确定