MySQL Forums
Forum List  »  General

How to make small tables from big table? (SELECT INTO doesn't seem to work)
Posted by: Fran Lee
Date: April 13, 2018 08:08AM

I'm trying to make a set of small tables from one large table.

Tried the below in mysql workbench but it thinks "tbl_stuff_01" is an undefined variable.

SELECT * INTO tbl_stuff_01 FROM tbl_stuff LIMIT 5 OFFSET 0;

CREATE TABLE works but (as I understand it) it doesn't retain info about the table like which field is primary key, etc.

I then thought SELECT INTO needed for the new small table to be created first but after reading I understand SELECT into should actually create the new table and copy the specified records and related table into into the new table.

1 - Does SELECT INTO work with mysql.
2 - What is the proper way to do this?

Thanks for any help.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.