From 76f0de1f8e11273bf3fb03b17e7bba5db2b21641 Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 07:07:45 -0500 Subject: [PATCH 01/11] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a7ce45..3656f19 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,9 @@ Reimport the Northwind database into PostgreSQL using pgAdmin. This is the same ```SQL - +Select customer_id +from customers +where city = 'London' ``` * [ ] ***find all customers with postal code 1010. Returns 3 customers*** From 15c46f957ba32e7aecacce0afe613b73aa0702c4 Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 07:09:56 -0500 Subject: [PATCH 02/11] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3656f19..1db47a0 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,9 @@ where city = 'London' * This can be done with SELECT and WHERE clauses -```SQL +```SQ Select customers +from customers +where postal_code = '1010' ``` From eb9b435d582ed2d6b27697cd88b30c50af130ec4 Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 07:15:50 -0500 Subject: [PATCH 03/11] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1db47a0..634fea4 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,9 @@ where postal_code = '1010' * This can be done with SELECT and WHERE clauses -```SQL +```SQL SELECT company_name ,phone +FROM suppliers +where supplier_id =11 ``` From 5fbcae2369b9d87f2226b4cfe1b19eabeb0c0ec9 Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 08:26:51 -0500 Subject: [PATCH 04/11] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 634fea4..a8eb64b 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,9 @@ where supplier_id =11 * This can be done with SELECT, WHERE, and ORDER BY clauses -```SQL +```SQL Select * +FROM orders +Where order_date = '1998-05-06' ``` From 71676716033637f9c507fd9e3e4b59eeeb0e122c Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 08:34:00 -0500 Subject: [PATCH 05/11] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a8eb64b..1382090 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,9 @@ Where order_date = '1998-05-06' * You can use `length(company_name)` to get the length of the name -```SQL +```SQL SELECT company_name +From suppliers +Where LENGTH (company_name) >20 ``` From 8517f414fedf25f3886735486dddd8dcae06ee4a Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 09:59:20 -0500 Subject: [PATCH 06/11] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1382090..c56a6b6 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,9 @@ Where LENGTH (company_name) >20 * Don't forget the wildcard '%' symbols at the beginning and end of your substring to denote it can appear anywhere in the string in question * Remember to convert your contact title to all upper case for case insensitive comparing so upper(contact_title) - + SELECT contact_title +FROM customers +WHERE upper(contact_title) LIKE '%MARKET%'; ```SQL ``` From 3862345bf290e1fae7f27c43b291b7dcb3a43391 Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 10:15:01 -0500 Subject: [PATCH 07/11] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c56a6b6..030db98 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,8 @@ WHERE upper(contact_title) LIKE '%MARKET%'; * This can be done with the INSERT INTO clause -```SQL +```SQL INSERT INTO customers(customer_id,company_name,contact_name,address,city,postal_code, country) + VALUES('SHIRE','THE Shire','Bilbo Baggins','1 Hobbit-Hole','Bag End', 111,'Middle Earth') ``` From ef439fb6de32926b08178e1d6d61af738aaeebf3 Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 10:22:23 -0500 Subject: [PATCH 08/11] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 030db98..25aa53a 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,9 @@ WHERE upper(contact_title) LIKE '%MARKET%'; * This can be done with UPDATE and WHERE clauses -```SQL +```SQL UPDATE CUSTOMERS +SET postal_code = 11122 +where customer_id = 'SHIRE' ``` From 01f86dbb2623dcf4d9a071c44418924b165eba82 Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 10:39:43 -0500 Subject: [PATCH 09/11] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 25aa53a..222a86d 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,10 @@ where customer_id = 'SHIRE' * There is more information about the COUNT clause on [W3 Schools](https://www.w3schools.com/sql/sql_count_avg_sum.asp) -```SQL +```SQL SELECT c.company_name Customer, COUNT(*) + FROM orders o JOIN customers c + ON c.customer_id = o.customer_id + GROUP BY c.company_name ``` From de63790c80f8848819aba66604d4e30faf8e9b61 Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 10:57:39 -0500 Subject: [PATCH 10/11] Update README.md --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 222a86d..bd8d58b 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,11 @@ where customer_id = 'SHIRE' * This can be done by adding an ORDER BY clause to the previous answer and changing the group by field - + SELECT c.contact_name contact, count(*) + FROM orders o JOIN customers c + ON c.customer_id = o.customer_id + GROUP BY c.contact_name + ORDER BY count desc ```SQL ``` @@ -174,7 +178,11 @@ where customer_id = 'SHIRE' * This is very similar to the previous two queries, however, it focuses on the City rather than the Customer Names -```SQL +```SQLSELECT c.city city, count(*) + FROM orders o JOIN customers c + ON c.customer_id = o.customer_id + GROUP BY c.city + ORDER BY count desc ``` From dde0cb841390338abf4299f742325063ee3360b2 Mon Sep 17 00:00:00 2001 From: George Hatzigeorgio <73345003+giorgio40@users.noreply.github.com> Date: Thu, 11 Mar 2021 11:07:06 -0500 Subject: [PATCH 11/11] Update README.md --- README.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bd8d58b..9634883 100644 --- a/README.md +++ b/README.md @@ -205,19 +205,28 @@ Below are some empty tables to be used to normalize the database Table Name: -| | | | | | | | | | +| PET ID | PET TYPE | | | | | | | | |------------|------------|------------|------------|------------|------------|------------|------------|------------| -| | | | | | | | | | -| | | | | | | | | | -| | | | | | | | | | -| | | | | | | | | | +| DOG | 1 | | | | | | | | +| HORSE 2 +|CAT | 3 | | | | | | | +| TURTLE | 4 | | | | | | | | +| FISH | 5 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Table Name: -| | | | | | | | | | +| Pet Type Pet Name Pet_type owner_id attribute_id + Ellie 1 1 4 + Joe 2 2 1 + Ginger 1 3 3 + Tiger 3 1 4 + Ms. Kitty 3 3 3 + Toby 4 1 4 + Bubble 5 3 3 + | | | | | | | | | |------------|------------|------------|------------|------------|------------|------------|------------|------------| | | | | | | | | | | | | | | | | | | | |