Abdallah Qaraeen
Abdallah Qaraeen

Reputation: 113

How to split a table into two in MySQL?

I have a table in MySQL that has data that looks like this:

ID Date Name Gender Age
1 2014/7/6 john M 33
2 2015/2/12 mike M 44
3 2001/2/9 emily F 57
.
.
.
500 2017/11/22 jasmine F 20

I want to take the bottom 200 rows and make them a new table. How can I do that?

Upvotes: 1

Views: 318

Answers (1)

Silencer310
Silencer310

Reputation: 1090

INSERT INTO `newTable`
SELECT * FROM `oldTable` 
WHERE ID > 300;

Assuming that your bottom 200 rows means when rows are sorted by ID's

Upvotes: 4

Related Questions