Merge pull request #1 from JMR-dev/jr-interludebranch

Completed through question 8
This commit was merged in pull request #1.
This commit is contained in:
Jason Ross
2022-02-21 15:51:16 -06:00
committed by GitHub
8 changed files with 75 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
projectnotes.md*
+2
View File
@@ -0,0 +1,2 @@
SELECT FirstName, LastName, Country FROM CUSTOMER
WHERE Country = 'Brazil';
+12
View File
@@ -0,0 +1,12 @@
SELECT
Customer.FirstName, Customer.LastName, Invoice.InvoiceId, Invoice.InvoiceDate, Invoice.BillingCountry
FROM
Invoice
INNER JOIN
Customer
ON
Invoice.CustomerId = Customer.CustomerId
WHERE
Invoice.BillingCountry = 'Brazil'
ORDER BY
LastName ASC;
+2
View File
@@ -0,0 +1,2 @@
SELECT CustomerId, FirstName, Country FROM CUSTOMER
WHERE COUNTRY != 'USA';
+31
View File
@@ -0,0 +1,31 @@
# Project Notes - SQL Interlude - Chinook
## Questions
### How to use NOT in queries
Why does
```
SELECT * FROM CUSTOMER
WHERE COUNTRY NOT LIKE 'USA';
```
work and
```
SELECT * FROM CUSTOMER
WHERE COUNTRY NOT 'USA';
```
does not work?
### Answer
To avoid using `LIKE` <br/>
`WHERE NOT customer.country = "USA";` <br/>
or <br/>
`WHERE NOT != "USA";` <br/>
are valid ways of forming the query.
## Resources
[How to concatenate columns in SQL - CONCAT_WS()](https://www.w3schools.com/sql/func_mysql_concat_ws.asp)
+14
View File
@@ -0,0 +1,14 @@
SELECT
EMPLOYEE.FirstName, EMPLOYEE.LastName, InvoiceId
FROM
Employee
INNER JOIN
INVOICE
ON
CUSTOMER.CustomerId = INVOICE.CustomerId
INNER JOIN
Customer
ON
Customer.SupportRepId = Employee.EmployeeId
ORDER BY
InvoiceId ASC;
+8
View File
@@ -0,0 +1,8 @@
SELECT DISTINCT
EMPLOYEE.FirstName, EMPLOYEE.LastName
FROM
EMPLOYEE
INNER JOIN
Customer
ON
EMPLOYEE.EmployeeId = Customer.SupportRepId;
+5
View File
@@ -0,0 +1,5 @@
SELECT DISTINCT
BillingCountry
FROM
INVOICE;