sql 高級 (三)(select into)

SELECT INTO 語句數據庫

        SELECT INTO 語句從一個表中選取數據,而後把數據插入另外一個表中。it

        SELECT INTO 語句經常使用於建立表的備份復件或者用於對記錄進行存檔。ast

  eg:select

                select   *   into  Persons_backup   from  Persons數據

                select   LastName,FirstName   into  Person_backup   From   Persons
db

       IN子句可用於向另外一個數據庫中拷貝表備份

        eg: join

            select  *  into  Persons  IN  'Backup.mdb'   from Persons

帶有where子句

    select    LastName,Firstname   into  Persons_backup   from  Persons  where   City='Beijing'

被鏈接的表

        select   Persons.LastName,  Orders.OrderNo    

        into     Persons_order_backup

        From    Persons

        Inner  join   Orders

        ON     Persons.Id_P=Orders.Id_P

相關文章
相關標籤/搜索