千家信息网

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

发表于:2025-01-20 作者:千家信息网编辑
千家信息网最后更新 2025年01月20日,create table emp_dept_txt as select first_name,last_name,email,phone_number,department_name from emp
千家信息网最后更新 2025年01月20日create table as select where 1=0会把null和not null属性也带上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)

0