Advertisement
Guest User

Untitled

a guest
Dec 26th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. CREATE TABLE users(
  2. userid bigint,
  3. username text,
  4. email text,
  5. dob text,
  6. loc text,
  7. mobile text,
  8. landlinenum text,
  9. PRIMARY KEY (userid));
  10.  
  11. INSERT INTO users (userid,username,email,loc,mobile) VALUES (0,'mreynolds','mal@serenity.com','Minneapolis','111-555-1234');
  12. INSERT INTO users (userid,username,email,loc,landlinenum,dob) VALUES (1,'jcobb','jayne@serenity.com','Minneapolis','111-555-3464','19620227');
  13. INSERT INTO users (userid,username,email,loc,mobile) VALUES (2,'dbook','derrial@serenity.com','New York','111-555-2349');
  14. INSERT INTO users (userid,username,email,loc,mobile,dob) VALUES (3,'stam','simon@serenity.com','San Francisco','111-555-8899','19750416');
  15. INSERT INTO users (userid,username,email,loc,dob) VALUES (4,'rtam','river@serenity.com','San Francisco','19810724');
  16.  
  17. aploetz@cqlsh:stackoverflow> SELECT * FROM users;
  18.  
  19. userid | dob | email | landlinenum | loc | mobile | username
  20. --------+----------+----------------------+--------------+---------------+--------------+-----------
  21. 2 | null | derrial@serenity.com | null | New York | 111-555-2349 | dbook
  22. 3 | 19750416 | simon@serenity.com | null | San Francisco | 111-555-8899 | stam
  23. 4 | 19810724 | river@serenity.com | null | San Francisco | null | rtam
  24. 0 | null | mal@serenity.com | null | Minneapolis | 111-555-1234 | mreynolds
  25. 1 | 19620227 | jayne@serenity.com | 111-555-3464 | Minneapolis | null | jcobb
  26.  
  27. (5 rows)
  28.  
  29. aploetz@cqlsh:stackoverflow> SELECT * FROM users_by_email WHERE email='river@serenity.com';
  30.  
  31. email | username | dob | landlinenum | loc | mobile | userid
  32. --------------------+----------+----------+-------------+---------------+--------+--------
  33. river@serenity.com | rtam | 19810724 | null | San Francisco | null | 4
  34.  
  35. (1 rows)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement