Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 22nd, 2012  |  syntax: None  |  size: 0.54 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Best way to store a SET bigger than 64
  2. Spain,France,Germany
  3.        
  4. create table countries (
  5.   iso_country_code char(3) primary key,
  6.   country_name varchar(50) not null unique
  7. );
  8.  
  9. insert into countries (country_name, iso_country_code) values
  10. ('AALAND ISLANDS', 'ALA'),
  11. ('AFGHANISTAN', 'AFG'),
  12. ('ALBANIA', 'ALB'),
  13. ...
  14. ('YEMEN', 'YEM'),
  15. ('ZAMBIA', 'ZMB'),
  16. ('ZIMBABWE', 'ZWE');
  17.  
  18. create table some_other_table_that_references_countries (
  19.   some_key ... primary key,
  20.   iso_country_code char(3) not null references countries (iso_country_code),
  21.   ...
  22. );