I want to pick one customer each month from the three countries, Germany, Canada, Brazil (table name Country). I need to generate their first , last name and their ID which is in another table called "customer". I had this idea to start of with but wasn't 100% if I was on right track.
SELECT DISTINCT CountryID FROM Country WHERE CountryName IN('Germany','Canada','Brazil') | Country ID | CountryName |
|---|---|
| 1 | Brazil |
| 2 | Germany |
| 3 | Canada |
| 4 | Norway |
| 5 | Czech Republic |
| 6 | Austria |
| 7 | Belgium |
The customer table
| col_pos | col_name | col_type | mandatory | primary | |
|---|---|---|---|---|---|
| 0 | CustomerId | INTEGER | 1 | NULL | 1 |
| 1 | FirstName | VARCHAR(40) | 1 | NULL | 0 |
| 2 | LastName | VARCHAR(20) | 1 | NULL | 0 |
| 3 | Company | VARCHAR(80) | 0 | NULL | 0 |
| 4 | Address | VARCHAR(70) | 0 | NULL | 0 |
| 5 | City | VARCHAR(40) | 0 | NULL | 0 |
| 6 | State | VARCHAR(40) | 0 | NULL | 0 |
| 7 | Country | VARCHAR(40) | 0 | NULL | 0 |
| 8 | PostalCode | VARCHAR(10) | 0 | NULL | 0 |
| 9 | Phone | VARCHAR(24) | 0 | NULL | 0 |
| 10 | Fax | VARCHAR(24) | 0 | NULL | 0 |
| 11 | VARCHAR(60) | 1 | NULL | 0 | |
| 12 | SupportRepId | INTEGER | 0 | NULL | 0 |
customer, and you want to pick them randomly from table customer. So why do we need tableCountry? is there a column calledCountryin the Customer table? please elaborate, and it would be nice to see tablecustomer