Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Copy Space

Engteg123 April 29, 2024

I want to write MySQL query Copy space with new space and new key. Can someone help me?

1 answer

1 accepted

0 votes
Answer accepted
Sudarsana G
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 29, 2024

Try this 

-- Create the destination_space if it doesn't exist
CREATE TABLE IF NOT EXISTS destination_space LIKE source_space;

-- Copy the data from source_space to destination_space
INSERT INTO destination_space
SELECT * FROM source_space;

-- Optionally, update specific columns if needed
UPDATE destination_space
SET space_key = 'new_space_key',
space_name = 'New Space Name';

-- Optionally, insert additional data if needed
INSERT INTO destination_space (column1, column2, ...)
VALUES (value1, value2, ...);

 

In this example:
First, you create the destination_space table with the same structure as source_space.
Then, you insert the data from source_space into destination_space using a SELECT statement.
If needed, you can update specific columns in destination_space to customize the copied data.
Finally, you can insert any additional data into destination_space as needed.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
PRODUCT PLAN
STANDARD
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events