From 80ca229d17cc7a60314ed1aa4c07b5faf7324d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Valen=C3=A7a?= Date: Fri, 7 Feb 2025 16:38:33 -0300 Subject: [PATCH 1/4] feat: add Guilhermevalenca/01.sql --- authors/Guilhermevalenca/01.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 authors/Guilhermevalenca/01.sql diff --git a/authors/Guilhermevalenca/01.sql b/authors/Guilhermevalenca/01.sql new file mode 100644 index 0000000..9453dd2 --- /dev/null +++ b/authors/Guilhermevalenca/01.sql @@ -0,0 +1 @@ +select * from products; \ No newline at end of file From 853278575fc1679b5a97f9e059605aa1016a1588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Valen=C3=A7a?= Date: Fri, 7 Feb 2025 16:44:09 -0300 Subject: [PATCH 2/4] feat: add Guilhermevalenca/02.sql --- authors/Guilhermevalenca/02.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 authors/Guilhermevalenca/02.sql diff --git a/authors/Guilhermevalenca/02.sql b/authors/Guilhermevalenca/02.sql new file mode 100644 index 0000000..a18ffd9 --- /dev/null +++ b/authors/Guilhermevalenca/02.sql @@ -0,0 +1,8 @@ +select + products.*, + suppliers.company_name +from + products +left join + suppliers + on products.supplier_id = suppliers.supplier_id; \ No newline at end of file From 2e629814efb815e989e45f8e1d40d611005eddd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Valen=C3=A7a?= Date: Fri, 7 Feb 2025 17:50:11 -0300 Subject: [PATCH 3/4] feat: add Guilhermevalenca/{03-08}.sql --- authors/Guilhermevalenca/03.sql | 10 ++++++++++ authors/Guilhermevalenca/04.sql | 10 ++++++++++ authors/Guilhermevalenca/05.sql | 8 ++++++++ authors/Guilhermevalenca/06.sql | 11 +++++++++++ authors/Guilhermevalenca/07.sql | 9 +++++++++ authors/Guilhermevalenca/08.sql | 10 ++++++++++ 6 files changed, 58 insertions(+) create mode 100644 authors/Guilhermevalenca/03.sql create mode 100644 authors/Guilhermevalenca/04.sql create mode 100644 authors/Guilhermevalenca/05.sql create mode 100644 authors/Guilhermevalenca/06.sql create mode 100644 authors/Guilhermevalenca/07.sql create mode 100644 authors/Guilhermevalenca/08.sql diff --git a/authors/Guilhermevalenca/03.sql b/authors/Guilhermevalenca/03.sql new file mode 100644 index 0000000..4e1cabb --- /dev/null +++ b/authors/Guilhermevalenca/03.sql @@ -0,0 +1,10 @@ +select + *, + customers.company_name, + concat(employees.first_name, ' ', employees.last_name) as full_name +from + orders +left join + customers on orders.customer_id = customers.customers.id +left join + employees on orders.employee_id = employees.employees.id; \ No newline at end of file diff --git a/authors/Guilhermevalenca/04.sql b/authors/Guilhermevalenca/04.sql new file mode 100644 index 0000000..bbd8af2 --- /dev/null +++ b/authors/Guilhermevalenca/04.sql @@ -0,0 +1,10 @@ +select + *, + categories.category_name, + suppliers.company_name +from + products +left join + categories on products.category_id = categories.category_id +left join + suppliers on products.supplier_id = suppliers.supplier_id; \ No newline at end of file diff --git a/authors/Guilhermevalenca/05.sql b/authors/Guilhermevalenca/05.sql new file mode 100644 index 0000000..eece083 --- /dev/null +++ b/authors/Guilhermevalenca/05.sql @@ -0,0 +1,8 @@ +select + customers.company_name, + count(orders.order_id) as total_orders +from + customers +left join + orders on customers.customer_id = orders.customer_id +group by customers.company_name; \ No newline at end of file diff --git a/authors/Guilhermevalenca/06.sql b/authors/Guilhermevalenca/06.sql new file mode 100644 index 0000000..0be2245 --- /dev/null +++ b/authors/Guilhermevalenca/06.sql @@ -0,0 +1,11 @@ +select + concat(employees.first_name, ' ', employees.last_name) as name, + 'R$ ' || round( cast( sum(order_details.quantity * order_details.unit_price) as numeric), 2) as total_sales +from + employees +left join + orders on orders.employee_id = employees.employee_id +left join + order_details on order_details.order_id = orders.order_id +group by + name; \ No newline at end of file diff --git a/authors/Guilhermevalenca/07.sql b/authors/Guilhermevalenca/07.sql new file mode 100644 index 0000000..0e4ef10 --- /dev/null +++ b/authors/Guilhermevalenca/07.sql @@ -0,0 +1,9 @@ +select + categories.category_name, + 'R$ ' || trunc( cast( avg(products.unit_price) as numeric), 2) as average_pre_product +from + categories +left join + products on categories.category_id = products.category_id +group by + categories.category_name; \ No newline at end of file diff --git a/authors/Guilhermevalenca/08.sql b/authors/Guilhermevalenca/08.sql new file mode 100644 index 0000000..11dbf19 --- /dev/null +++ b/authors/Guilhermevalenca/08.sql @@ -0,0 +1,10 @@ +select + customers.company_name +from + customers +left join + orders on orders.customer_id = customers.customer_id +where + orders.order_id is null +group by + customers.company_name; \ No newline at end of file From 9dcf3bc3793c6972e86956800f6b14a40b43981c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Valen=C3=A7a=20Rodrigues=20Pereira?= <56165820+Guilhermevalenca@users.noreply.github.com> Date: Tue, 11 Feb 2025 15:34:59 -0300 Subject: [PATCH 4/4] Update 03.sql --- authors/Guilhermevalenca/03.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authors/Guilhermevalenca/03.sql b/authors/Guilhermevalenca/03.sql index 4e1cabb..abb13ef 100644 --- a/authors/Guilhermevalenca/03.sql +++ b/authors/Guilhermevalenca/03.sql @@ -5,6 +5,6 @@ select from orders left join - customers on orders.customer_id = customers.customers.id + customers on orders.customer_id = customers.customer.id left join - employees on orders.employee_id = employees.employees.id; \ No newline at end of file + employees on orders.employee_id = employees.employee.id;