Notas
Sem título
Conteúdo das notas (1)
Página 1
Quesions ON JOIN
Q1) Provide a table for all web_events associated with account name of Walmart. There should be three columns. Be sure to include the primary_poc, time of the event, and the channel for each event. Additionally, you might choose to add a fourth column to assure only Walmart events were chosen.
SELECT a.primary_poc, w.channel, w.occurred_At , a.name FROM accounts as a JOIN web_events as w ON a.id=w.account_id WHERE a.name='Walmart'
Q2) Provide a table that provides the region for each sales_rep along with their associated accounts. Your final table should include three columns: the region name, the sales rep name, and the account name. Sort the accounts alphabetically (A-Z) according to account name.
SELECT r.name as region_name, s.name as sales_rep_name, a.name as accounts_name FROM region as r JOIN sales_reps as s ON r.id=s.region_id JOIN accounts as a ON a.sales_rep_id=s.id ORDER BY accounts_name
Informações
- Descrição
- Notas sobre Sem título, criado por pradosa patnaik em 14-07-2018.
- Criado por
- pradosa patnaik
- Visualizações
- 1
- Avaliação