ITPub博客

首页 > 数据库 > Oracle > create table as select where 1=0会把null和not null属性也带上

create table as select where 1=0会把null和not null属性也带上

原创 Oracle 作者:lusklusklusk 时间:2017-08-16 16:12:50 0 删除 编辑
create table emp_dept_txt as select first_name,last_name,email,phone_number,department_name from employees ,departments where employees.department_id=departments.department_id and 1=0;

SQL> select * from emp_dept_txt;
no rows selected

SQL> desc emp_dept_txt
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 FIRST_NAME                                         VARCHAR2(20)
 LAST_NAME                                 NOT NULL VARCHAR2(25)
 EMAIL                                     NOT NULL VARCHAR2(25)
 PHONE_NUMBER                                       VARCHAR2(20)
 DEPARTMENT_NAME                           NOT NULL VARCHAR2(30)

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30126024/viewspace-2143653/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Welcome to Lukes DB HOME。 Oracle OCM、Mysql OCP, 10年DBA工作经验,博客仅记录自己的一个学习过程,不代表完全准确,如有需要,欢迎转载。

注册时间:2015-02-02

  • 博文量
    348
  • 访问量
    1174971