Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
165 views
in Technique[技术] by (71.8m points)

sql server - Can you insert tables themselves to another table?

So I decided to experiment SQL via nesting a table into another.

This might complicate you, so I'll need some explaining.

I just started using SQL once again and I want to try some nesting techniques.

What I want to do is to select a whole table (T1) and insert it to another table (T2) in a single plot of T2 whereas the data from T1 is still kept.

I still have little knowledge about SQL, and I decided to make some draft first:

CREATE TABLE InnerTable 
{
    blah blah blah;
};

CREATE TABLE OuterTable 
{
    blah blah blah;
}

INSERT INTO OuterTable (blah blah blah) VALUES (blah blah blah);
INSERT INTO InnerTable (blah blah blah) VALUES (blah blah blah);
INSERT INTO OuterTable (blah blah blah) VALUES (InnerTable);

Then I also read this which doesn't seem like what I wanted to do.

And now I have to figure out how to make the program functional and do what I wanted.

Is there a way to insert a table inside another?

question from:https://stackoverflow.com/questions/65640794/can-you-insert-tables-themselves-to-another-table

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...