It is possible in MySQL (using MyISAM storage engine only) to create a table from scratch using symlinks. It is posssible in Linux and Windows (using hardlinks) :
Here are my past posts on this subject
However, what you are proposing would have to be done outside of MySQL in Linux.
For this example
- /var/lib/mysql is datadir
- Create table1 as MyISAM table in database mydb
- Create table2 as pure symlinks to table1
STEP 01) Create table1
CREATE TABLE mydb.table1
(
id int not null auto_increment,
mydata varchar(255) not null,
primary key (id)
) ENGINE=MyISAM;
STEP 02) Create three symlinks to mimic TableB
cd /var/lib/mysql/mydb
ln -s table1.frm table2.frm
ln -s table1.MYD table2.MYD
ln -s table1.MYI table2.MYI
STEP 03) Try inserting into table1 and reading from table2. Then try the reverse.
INSERT INTO table1 (mydata) VALUES ('rolando'),('edwards');
SELECT * FROM table2;
INSERT INTO table2 (mydata) VALUES ('abraham'),('lincoln');
SELECT * FROM table1;
If everything behaves normal, then this is how you can do this.
CAVEAT
- There is only one table, table1
- If you do any DDL
- Perform the DDL on table1
- You must recreate the table2 symlinks after DDL against table1