Created
June 25, 2021 12:52
-
-
Save saqibmehmoodgit/77cb4194289e99f0a0d34772815c12f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user friends | |
userid name uid friendid | |
1 abc 1 2 | |
2 def 1 3 | |
3 xyz 2 3 | |
4 ghf 3 4 | |
where as uid and friendid in friends table are composite primary key and they are forign key from userid of user tabale . | |
question 1) when i have to insert into friends table than i will insert like "insert into friends(udi , friendid) values(1,2)" . | |
am i correct? | |
question 2) when i have to select frieds list for user 1 than query | |
"select f.name from user u outer join friends f on u.userid = f.friendid and f.uid =1 " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment