Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. id first_name last_name email phone
  2. ------------------------------------------------------------------------
  3. 1 Michael Turley mturley@whatever.com 555-123-4567
  4. 2 John Dohe jdoe@whatever.com
  5. 3 Jack Smith jsmith@whatever.com 555-555-5555
  6. 4 Johnathan Doe 123-456-7890
  7.  
  8. id first_name last_name email phone
  9. ------------------------------------------------------------------------
  10. ? John Doe jdoe@whatever.com 123-456-7890
  11.  
  12. DELETE FROM customers WHERE id = 4;
  13.  
  14. UPDATE customers
  15. SET first_name = 'John',
  16. last_name = 'Doe',
  17. email = 'jdoe@whatever.com',
  18. phone = '123-456-7890'
  19. WHERE id = 2;
  20.  
  21. UPDATE orders, rewards, receipts
  22. SET customer_id = 2
  23. WHERE customer_id = 4;
  24.  
  25. use information_schema;
  26. select table_name from columns where column_name = 'customer_id';
  27.  
  28. SELECT `TABLE_NAME`
  29. FROM `information_schema`.`KEY_COLUMN_USAGE`
  30. WHERE REFERENCED_TABLE_SCHEMA='DATABASE'
  31. AND REFERENCED_TABLE_NAME='customers'
  32. AND REFERENCED_COLUMN_NAME='customer_id'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement