Create New Table by Selecting Data from Other Tables with CREATE TABLE AS Створити нову таблицю, вибравши дані з інших таблиць з CREATE TABLE AS
By using SQL data manipulation statement, a new, temporary, backup or regular table can be created and filled or inserted with data from another table or tables retrieved by SELECT statement. За допомогою SQL маніпулювання даними заяви, новий, тимчасовий, регулярне резервне копіювання або таблиці може бути створений і заповнений або вставити дані з іншої таблиці або таблиць вилучення ЗЕ'ЕСТ. The SQL data manipulation language is CREATE TABLE AS which can be used to create a new table built from contents of result set by a query on a table that already exists within the database. SQL маніпуляції даними мови CREATE TABLE як які можуть бути використані для створення нової таблиці побудовані з вмісту результуючого набору запиту на таблиці, яка вже існує в базі даних. Both the column types, and row data for the new table, come from the SELECT command specified by select. Обидва типи стовпців і рядків даних для нової таблиці, родом з команди SELECT передбачених вибрати.
CREATE TABLE AS has the following syntax or synopsis in simple form: CREATE TABLE AS має наступний синтаксис або коротку оцінку в простій формі:
CREATE TABLE new_table_name [ ( column [, ...] ) ] AS SELECT [ ( column [, ...] ) ] FROM existing table_name CREATE TABLE new_table_name [(стовпчик [, ...])] AS SELECT [(стовпчик [, ...])] від існуючої table_name
The SELECT statement can be in a complex form where data is been retrieved from several tables. SELECT Заява може бути в складній формі, де дані були отримані з кількох таблиць. For the new table, column names can be specified by including the column names in a comma-delimited list. Для нової таблиці, імена стовпців можна задати в тому числі імена стовпців в комами список. Very important point to take note is that there should be the same number of columns specified in the column list preceding the AS clause (optional, if specified) for new table as the number of target columns that are returned by the select statement. Дуже важливо взяти до уваги, що не повинно бути однакове число стовпців, зазначених у списку стовпців попередньому реченні (необов'язково, якщо він вказаний) для нової таблиці, як кількість цільових стовпців, повертається виберіть заявою. If the optional list of columns in parentheses of new table contains different number of rows than the rows the SELECT statement returns, the following error message will be displayed: Якщо додатковий список стовпців у дужках нової таблиці міститься різну кількість рядків, ніж рядок SELECT повертає заяву, таке повідомлення про помилку з'явиться:
ERROR: CREATE TABLE/AS SELECT has mismatched column count ПОМИЛКА: CREATE TABLE / AS SELECT має невідповідні число стовпців
In its simplest form, CREATE TABLE AS statement will create a complete backup of an existing table including all columns and data simply by using the statement CREATE TABLE new_table_name AS SELECT * FROM existing_table_name . У своїй простій формі, CREATE TABLE заяви, створить повну резервну копію існуючої таблиці всі стовпці, в тому числі й дані, просто за допомогою оператора CREATE TABLE new_table_name AS SELECT * existing_table_name ВІД.
IMPORTANT : The page is machine translated and provided "as is" without warranty. ВАЖЛИВО: Сторінка машина переведена і надаються "як є" без гарантії. Machine translation may be difficult to understand. Машинний переклад може бути важким для розуміння. Please refer to Будь ласка, зверніться до original English article оригінальний англійська статтю whenever possible. коли це можливо.
Related Articles Статті за Темі
- Easily Duplicate, Copy or Backup Tables in Oracle, PostgreSQL, DB2 and SQLite with Create Table As SQL Легко дублювання, копіювання або резервного копіювання в Oracle, PostgreSQL, DB2 і SQLite з Створення таблиці як SQL --
- ORA-02449 Oracle Drop Table Error ORA-02449 Oracle Drop Table помилку
- ORA-00942 Table or View Does Not Exist Oracle Error ORA-00942 таблиця або подання не існують Oracle Error
- Create Business Graphics Via VizLytics Data Visualization Tool Створення бізнес-графіки Via VizLytics інструмент візуалізації даних
- Oracle ORA-14074 Create or Add New Partition Fails Error Oracle ORA-14074 Створити або додати нові розділи Збій помилку
- Crack and Hack to Find, Reveal, Get, Recover and Retrieve All Windows Passwords with Ophcrack 2 and Rainbow Tables Тріск і Рубати знайти, виявити, Get, відновити і отримати всі паролі Windows з Ophcrack 2 і Rainbow таблиць
- SLIC Table (SLIC.BIN or ACPISLIC.BIN) BIOS File for OEMs Download SLIC таблиці (SLIC.BIN або ACPISLIC.BIN) файл прошивки для збирачів Завантажити
- PDFtoExcel Online Tool Extract PDF Tables to Excel Format PDFtoExcel Інтернет інструменту Extract PDF таблиць у форматі Excel
- How to Show and Display IP Routing Table in Windows or Linux Як показувати і виставляти таблиці IP-маршрутизації в Windows або Linux
- Create, Add or Split Oracle Database Partition Fails with ORA-14080 Error Створення, додати або Split Oracle Database розділів збій з ORA-14080 помилка










































September 5th, 2009 14:30 5 вересня 2009 14:30
Check your select statement again and shuffle the joining conditions in where clause. Перевірте вашу виберіть заяві знову і Shuffle вступ в умовах, де становище. No need to change but change the position. Не треба змінювати, але змінити становище. Try to equate id's first and contants latter. Спробуйте зрівняти ID першій і останній Contants. Hope this will solve your problem. Сподіваюся, що це вирішить вашу проблему.
January 28th, 2009 17:46 28 січня 2009 17:46
CREATE TABLE new_table_name [ ( column [, ...] ) ] AS SELECT [ ( column [, ...] ) ] FROM existing table_name CREATE TABLE new_table_name [(стовпчик [, ...])] AS SELECT [(стовпчик [, ...])] від існуючої table_name
this query possible in MS-ACCESS or not Можливо цей запит в MS-Access чи ні
January 10th, 2008 13:31 10 січня 2008 13:31
Data in the table that is created using create table as select” is different from the data that is returned when the same select that creates the table is executed separately???? Дані в таблиці, яка створюється за допомогою створення таблиці виберіть пункт "відрізняється від даних, який повертається, якщо ж вибрати, що створює таблиці виконується окремо??
WE are using the tool PL/SQL Developer . Ми використовуємо інструменту PL / SQL Developer.
Any idea what this problem is due to? Будь-яка ідея, що ця проблема викликана?
April 1st, 2007 03:26 1 квітня 2007 03:26
We can do it also with the query, Ми можемо зробити це і з запитом,
SELECT * INTO newtable FROM existingtable SELECT * INTO newtable ВІД existingtable
I think its a little bit shorter. Я думаю, свою трохи коротше.