`
PlayIT1024
  • 浏览: 21172 次
  • 性别: Icon_minigender_2
  • 来自: 泉州
社区版块
存档分类
最新评论

with as insert into报1064

阅读更多

with as后面直接跟insert into select会报1064:

with temp_table as (select * from table limit 1)
insert into table 
select * 
from temp_table 
where 1=2

 

with as放在select之前即可正常插入:


insert into table 
with temp_table as (select * from table limit 1)
select * 
from temp_table 
where 1=2

 

分享到:
评论

相关推荐

    select into和insert into select使用方法

    ### 使用Select Into与Insert Into Select进行表复制的方法 在数据库管理与操作中,`SELECT INTO`与`INSERT INTO SELECT FROM`是两种常见的用于复制或创建新表的方式。这两种语句虽然相似,但在实际使用场景中有着...

    Mssql 三种临时表的使用场景 insert into 与 select into与With as.docx

    在本文中,我们将探讨这三种临时表的使用场景,以及`INSERT INTO`、`SELECT INTO`和`WITH AS`语句的应用。 1. **INSERT INTO @NewTable1 SELECT...** 这种方式创建的是一个表变量,通常用于在存储过程或批处理内部...

    itpub.net]summit2

    INSERT INTO s_customer VALUES ( 201, 'Unisports', '55-2066101', '72 Via Bahia', 'Sao Paolo', NULL, 'Brazil', NULL, 'EXCELLENT', 12, 2, NULL); INSERT INTO s_customer VALUES ( 202, 'OJ Atheletics', ...

    mysql中insert与select的嵌套使用解决组合字段插入问题

    首先,当我们要在两个表之间进行简单的数据迁移时,可以使用以下基本的`INSERT INTO SELECT`语句: ```sql INSERT INTO db1_name(field1, field2) SELECT field1, field2 FROM db2_name; ``` 这里,`db1_name`是...

    db2认证 000-541,102q

    CREATE VIEW V2 AS SELECT COI1 FROM v1 WITH CASCADED CHECK OPTION CREATE VIEW v3 AS SELECT coll FROM v2 WHERE coll ; Which statement will fail? A. INSERT INTO v2 VALUES (35) B. INSERT INTO v1 VALUES ...

    oracle数据库startwith用法

    INSERT INTO TBL_TEST (ID, NAME, PID) VALUES ('1', '10', '0'); INSERT INTO TBL_TEST (ID, NAME, PID) VALUES ('2', '11', '1'); INSERT INTO TBL_TEST (ID, NAME, PID) VALUES ('3', '20', '0'); INSERT INTO ...

    Hive那些事儿之八-大数据踩过的坑——Hive insert

    insert into db_name.table_name_1 ( col_1,col2,col3 ) with temp_table_1 as ( select id,col_2 from db_name.table_name_2 where id = condatition ), temp_table_2 as ( select id,col_3 from db_name....

    java影院订票系统完整可运行配ORACLE数据库代码 SSH框架

    Connect scott/****@myoracle AS SYSDBA create USER goupiaoXT IDENTIFIED BY passward DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP; grant connect to goupiaoXT; grant resource to goupiaoXT; ...

    WITH CHECK OPTION的用法

    SQL> insert into (select object_id, object_name, object_type from xxx where object_id < 1000 WITH CHECK OPTION) 2 values(999, 'testbyhao', 'testtype'); ``` 这段代码成功执行,因为尝试插入的数据...

    插入数据大锦集

    WITH temp AS ( SELECT * FROM some_table WHERE condition ) INSERT INTO target_table SELECT * FROM temp; ``` 5. **使用`OUTPUT`子句跟踪变化**:`OUTPUT`子句可以捕获插入或更新操作产生的新或旧行。 ```sql...

    ORACLE_视图的_with_check_option.doc

    INSERT INTO IS_student VALUES ('95100', '李娜', 12); ``` 而不使用`WITH CHECK OPTION`,这个插入操作则可能成功,因为默认情况下,视图不会阻止那些在插入后不符合视图定义的数据。 `WITH CHECK OPTION`的基本...

    dtl.zip_As You Like It

    As a user, you can move through our containers using standard STL iterators and if you insert(), erase() or replace() records in our containers changes can be automatically committed to the database ...

    PostgreSQL实现批量插入、更新与合并操作的方法

    SELECT * FROM unnest(array[[1, 30, 'val1'], [2, 40, 'val2']]) WITH ORDINALITY AS t(id, col1, col2, ordinality) ) INSERT INTO testunnest (id, col1, col2) SELECT id, col1, col2 FROM data ON CONFLICT ...

    Silver clusters insert into polymer solar cell for enhancing light absorption

    As an employment of surface plasmonic effect, the consequence of insertion of a layer of Ag clusters into polymer solar cell on the enhancement of light absorption and power conversion efficiency is ...

    SqlDataBuilder

    The development of this software is to generate the script of such kind of data to insert into the destination according to the data source, it also create a .bat file to perform the SQL script ...

    Oracle单条SQL语句可以做什么.pdf

    WITH max_a AS (SELECT MAX(a) AS max_a FROM t), max_rows AS (SELECT ROWNUM AS rn FROM dual CONNECT BY ROWNUM (SELECT max_a FROM max_a)) SELECT t.a, t.b, m.rn FROM t, max_rows m WHERE t.a >= m.rn ORDER...

    sqlserver 2005 使用CTE 实现递归

    INSERT INTO Employee_Tree VALUES ('Richard', 1, NULL); INSERT INTO Employee_Tree VALUES ('Stephen', 2, 1); INSERT INTO Employee_Tree VALUES ('Clemens', 3, 2); INSERT INTO Employee_Tree VALUES ('Malek'...

    IBM 000-541认证题库

    CREATE VIEW V2 AS SELECT COI1 FROM v1 WITH CASCADDED CHECK OPTION; CREATE VIEW v3 AS SELECT col FROM v2 WHERE col ; ``` **问题:** 哪个插入语句会失败? A. INSERT INTO v2 VALUES(35) B. INSERT INTO v1 ...

    2024 ETL开发公司面试题

    INSERT INTO TableA VALUES ('ano1', '0755,0789,010,0112', '0731,07323'); INSERT INTO TableA VALUES ('ano2', '020,021,022', NULL); ``` 3. **拆分字段:** ```sql WITH SplitData AS ( SELECT Id, ...

Global site tag (gtag.js) - Google Analytics