From the course: Database Foundations: Database Management

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Duplicate tables

Duplicate tables

From the course: Database Foundations: Database Management

Start my 1-month free trial

Duplicate tables

- [Instructor] You may occasionally want to create a copy of a table in your database. This may be to gather rows for an analysis by a third-party contractor, or for a temporary reporting exercise, or just to experiment with alternative designs without impacting the current workload of day-to-day activities. When this happens, you don't need to create an empty table and then write in all of the insert statements yourself. You can create the table structure and populate the rows with information by duplicating an existing table. Let's take a look at how this works in the PostgreSQL server. I'll create a new query window attached to that database server. First, I want to review the current contents of the inventory.products table. Now, as you can see, there are lots of products in this table. One of the attributes is a category_id number. At the bottom of this result set, you'll find a number of products in category number 3. This corresponds to our bath and beauty product category…

Contents