In SQL server I have two tables social_media_profile and tweets_info. The social
ID: 3708272 • Letter: I
Question
In SQL server I have two tables social_media_profile and tweets_info. The social_media_profile table has one column called SmID and it is the primary key. The tweets_info table has links, timestamp, and SmID columns, SmID is the foreign key. Using T-SQL, I need help with storing the links of each tweet or post, along with the time stamp. The link should be stored with the proper user id, in this case, the proper SmID. Each tweet/post and timestamp should have its own row. How do I do this?
This screenshot should provide some visual view of the type of data I am working with. Each tweet and timestamp should be matched to the proper profile. The values cannot be hardcoded, they should be stored everytime a user makes a tweet or post. So I think it would be neccessary to use parameters?
Timestamp Your Twitter profile List of tweets/retweets 2102171142 07 i https://twitter.com/dummytweets/stat/3443503505030403024 2/10/2017 11:47:07 https://twitter com/dummyuser2000 https:/twitter.com/dummytweets/stat/3443503505030403024Explanation / Answer
T-SQL is nothing but extension of SQL language providing certain benefits in Transactions.
*********************SQL QUERY**************************************
Select SmID from as 'SocialMediaID' from social_media_profile where SmID = 'dummyuser2000';
Begin TRANSACTION
INSERT INTO tweets_info (SmID, link, timestamp) values
SocialMediaID, 'https://twitter.com/dummyuser2000/tweets/1', '2/10/2017 11:47: 07' UNION ALL
SocialMediaID, 'https://twitter.com/dummyuser2000/tweets/2', '2/10/2017 11:47: 07'
COMMIT TRANSACTION
The union all operator ensures data entry into new rows everytime.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.