I have 2 tables. USER with all personal data and TWEETTABLE with all tweets from the user timeline obtained via twitter api
User table
id|twitter_user_name|firstname|lastname|email ----------------------------------------------- 1 | @johnsmith |john |smith | js@gmail.com
tweettable
name|scr_name|tweets |created_at_ |followers_count ---------------------------------------------------------- CNN |CNN |*tweet text*| 14nov 12:32| 38713286
I really want:
id| twitter_details | -----|------------------------------------------------------- | |name |scr_name|tweets |created_at_ |followers_count| | ----|--------|------------|------------|-------------- 1 | CNN|CNN |*tweet text*| 14nov 12:32| 38713286 | ----|------------------------------------------------------ 2 | BBC|BBC |*tweet text*| 14Nov 16:43| 38713254 | ----|-----|--------|------------|------------|---------------|------ 3
i.e. a table inside a column. Column 1 will have a user ID and a second column with all its corresponding timeline rows. I can do this in oracle by doing the following:
CREATE TYPE tweet_typ AS OBJECT ( name VARCHAR2(20), scr_name VARCHAR2(25), tweets text, created_at timestamp; followers count VARCHAR2(25) ) MEMBER PROCEDURE display_details (SELF IN OUT twitter_typ ) );
and use this inside the twitter_details column as a nested table
CREATE TABLE TWEETTABLE ( id INT, twitter_details tweet_typ );
And then insert
INSERT INTO TWEETTABLE VALUES ( 1,twitter_typ (
But Mysql does not allow nested tables. So how can I define twitter as an object and make it a nested table inside the twitter_details column in mysql?
source share