Easily Duplicate, Copy or Backup Tables in Oracle, PostgreSQL, DB2 and SQLite with Create Table As SQL簡単に重複し、オラクルのテーブルのバックアップコピーまたは、 PostgreSQLでテーブルを作成するとしてのDB2とSQLiteのSQL

In Oracle, PostgreSQL, DB2 and SQLite database system, there is a nice command feature called Create Table As which allows easy duplicating of a table with data from another or a few other tables. OracleでのPostgreSQL 、 SQLiteデータベースdb2およびシステム、ニースには、コマンドの機能と呼ばれるテーブルを作成これにより、テーブルにデータを簡単に複製またはごく少数の他のテーブルから別のです。 The SQL command can also be used to ‘copy and paste’ a table exactly or backup a table data before performing data manipulation query on the original table, just in case the script has error and the backup date can be used to restore to original state. Create Table As will creates a new table built from the content of dataset or result set retrieved by a Select SQL query from a table that already exists within the database. SQLコマンドに使用されることもできます。 'をコピーして貼り付け'を正確にテーブルまたはテーブルのデータをバックアップするデータの操作を実行する前にクエリを実行して元のテーブルは、念のために、スクリプトは、エラーが発生し、バックアップの日付を使用して元の状態に復元するです。 テーブルを作成する新しいテーブルを作成するに組み込まれたデータセットのコンテンツから結果セットを取得するかを選択し 、テーブルからSQLクエリを実行することが既に存在する場合に、データベースです。

The syntax of Create Table As SQL statement is:テーブルを作成するSQLステートメントの構文は:

CREATE TABLE table_name [ ( column_name [, ...] ) ]テーブルにインデックスを作成[ ( column_name [ 、 ... ] ) ]
AS select [ * !として選択し[ * ! ( column_name [, ...] ) ] FROM source_table_name ( column_name [ 、 ... ] ) ]からsource_table_name

Replace table_name with the name of the new table that will be created.インデックスの名前を置き換えると、新しいテーブルが作成されることです。 Column name is optional, where you can specify multiple columns by including their names in a comma-delimited list.カラム名は任意ですが、ここで指定することもできます自分の名前を含む複数のカラムを、カンマ区切りのリストです。 Else, the structure of the new table will be based on the column names, types and number of columns returned by the Select statement, together with the row data.ほか、新しいテーブルの構造をされるのカラム名に基づいて、種類とのカラム数を取得するには、 SELECTステートメントの行のデータと一緒にします。 If you specify the column name, note that there should be the same number of columns specified as are returned by select.カラム名を指定した場合、に注意して存在する必要がありますとして指定されるのと同じ数の列が返さを選択します。

The select statement at the end of create table as command must be valid, and has the number of targets selected matching the number of columns in the optional column list preceding the AS clause. SELECTステートメントの終わりにテーブルを作成する有効なコマンドをしなければならない、との目標には、数にマッチするのカラム数を選択し、オプションのカラムリストに先行し、として、節です。 It can be a complex select statement that retrieve data from multiple tables.それには、複雑なSELECTステートメントが複数のテーブルからデータを取得します。 If optional column list is specified within parentheses, asterisk (*) can no longer be used in the select statement.オプションのカラムリストを指定しない場合に括弧、アスタリスク( * )が使用されていることはできなくSELECTステートメントです。

For example,たとえば、

CREATE TABLE demo_backupテーブルを作成demo_backup
AS SELECT * FROM demo; *からデモとして選択;

Above SQL statement will create a exact replica backup table named demo_backup with data and structure (columns) of demo table.上記のSQLステートメントは、正確なレプリカを作成するdemo_backupという名前のテーブルにデータをバックアップと構造(カラム)のデモ表のとおりです。

Possible error if you specify the optional column list is:可能なエラーが発生列を指定する場合は、オプションのリストは:

ERROR: CREATE TABLE/AS SELECT has mismatched column countエラー:作成テーブル/としては、不適当な列数を選択

If you encounter this error message, this is due to optional list of columns in parentheses contains a different number of rows than the select statement returns.このエラーメッセージが表示さに遭遇したら、これはオプションのために列のリストを括弧内には、別の行数を戻り値よりも、 SELECTステートメントです。 Double check if the number of columns specified is the same with the results that are expected from the select resultset.ダブルチェックのカラム数を指定した場合は、同じし、その結果は、予想よりは、結果セットの選択です。

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要 :これは、機械翻訳ページで提供"現状有姿"を保証します。 Machine translation may be difficult to understand.機械翻訳を理解するのは難しいかもしれません。 Please refer toを参照してください original English articleオリジナルの英語記事索引 whenever possible.いつ可能です。

Share and contribute or get technical support and help atを共有して貢献や技術サポートとヘルプを得る My Digital Life Forums 私のデジタルライフフォーラム .です。



Leave a Reply残して返信

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> これらのタグを使用することができます: <aのhref=のtitle= <abbrのtitle= <blockquote cite=""> <cite> <acronymのtitle= <b>ダウンロードの<code> <デル日時= " " >の<em> <i>て<strike> <strong> <q cite="">

Subscribe without commenting登録なしのコメント


Custom Search

New Articles新しい記事

Incoming Search Terms for the Article検索用語を受信するには

oracle copy table Oracleのコピーテーブル - - oracle backup table Oracleのバックアップテーブル - - copy table oracle コピーテーブルのオラクル - - backup table oracle バックアップテーブルのオラクル - - sql backup table SQLバックアップテーブル - - sqlite copy table sqliteをコピーテーブル - - backup oracle table Oracleテーブルのバックアップ - - backup table in oracle Oracleのテーブルにバックアップ - - table backup in oracle Oracleのテーブルのバックアップ - - COPY TABLE in oracle Oracleのテーブルにコピーする - - oracle table backup Oracleテーブルのバックアップ - - db2 copy table DB2のコピーテーブル - - oracle table copy Oracleテーブルのコピー - - postgresql duplicate table PostgreSQLの重複テーブル - - copy oracle table Oracleテーブルのコピー - - sql duplicate table 重複するテーブルのSQL - - oracle copy table data Oracleのテーブルにデータをコピー - - copy table db2 コピーテーブルのDB2 - - oracle backup a table Oracleのテーブルをバックアップする - - oracle sql copy table オラクルのSQLコピーテーブル - - create backup table in oracle オラクルのバックアップテーブルを作成する - - all すべての - - How to backup table in oracle オラクルのテーブルをバックアップする方法について - - BACKUP A TABLE IN ORACLE オラクルのテーブルをバックアップする - - postgresql copy table PostgreSQLのコピーテーブル - - backup tables in oracle オラクルのテーブルのバックアップ - - ORACLE SQL COPY オラクルのSQLコピー - - postgres duplicate table Postgresはテーブルの重複 - - SQL ORACLE copy table テーブルのSQL Oracleのコピー - - DB2 table copy DB2テーブルのコピー - - copy table oracle sql コピーテーブルオラクルのSQL - - sql copy table テーブルのSQLをコピー - - copy table sql oracle コピーテーブルのSQLオラクル - - duplicate table oracle 重複するテーブルのオラクル - - oracle duplicate table Oracleの重複テーブル - - oracle backup tables Oracleのバックアップテーブル - - oracle table backup command Oracleテーブルのバックアップコマンド - - oracle copy statement Oracleのコピー声明 - - oracle copy a table Oracleのテーブルをコピーする - - backup an oracle table バックアップするOracleテーブル - - db2 backup table DB2のバックアップテーブル - - how to backup an oracle table どのようにOracleテーブルをバックアップする - - postgres backup postgresをバックアップ - - copying a table in oracle オラクルのテーブルをコピーする - - db2 copy tables DB2のコピーテーブル - - oracle sql backup table OracleのSQLバックアップテーブル - - oracle backup table data Oracleのテーブルのデータのバックアップ - - db2 table backup DB2テーブルのバックアップ - - copy table postgres テーブルpostgresをコピー - - SQL STATEMENT COPY TABLE SQLステートメントをコピーするテーブル - -