SHARE
TWEET

Untitled

a guest Jun 20th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TABLE Users(
  2. uid int PRIMARY KEY,
  3. name text,
  4. phone text
  5. );
  6. CREATE TABLE Messages(
  7. recipient int REFERENCES Users(uid),
  8. sender int REFERENCES Users(uid),
  9. time timestamp NOT NULL,
  10. message text NOT NULL,
  11. PRIMARY KEY (recipient, sender, time)
  12. );
  13.      
  14. SELECT COUNT(distinct U2.uid)
  15. FROM Users U2,Messages M
  16. WHERE M.sender=U2.uid AND U2.name<>'Freddy'  AND M.recipient=(SELECT  U.uid FROM Users U,Messages M
  17. WHERE M.recipient=U.uid AND M.sender=(SELECT uid FROM Users where name='Freddy'))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top