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

jr interludebranch
This commit was merged in pull request #2.
This commit is contained in:
Jason Ross
2022-02-21 16:00:20 -06:00
committed by GitHub
4 changed files with 17 additions and 32 deletions
+1 -1
View File
@@ -1 +1 @@
projectnotes.md*
projectnotes.md
+10
View File
@@ -0,0 +1,10 @@
SELECT
INVOICE.Total, CUSTOMER.FirstName, CUSTOMER.LastName, EMPLOYEE.FirstName, Employee.LastName, Invoice.BillingCountry
FROM
((Customer
INNER JOIN
Employee ON Employee.EmployeeId = Customer.SupportRepId)
INNER JOIN
INVOICE ON INVOICE.CustomerId = Customer.CustomerId)
ORDER BY
INVOICE.Total DESC;
-31
View File
@@ -1,31 +0,0 @@
# 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)
+6
View File
@@ -0,0 +1,6 @@
SELECT strftime('%Y', InvoiceDate) as Year,
COUNT(*) as InvoiceCount
FROM Invoice
WHERE strftime('%Y', InvoiceDate) = '2009'
OR strftime('%Y', InvoiceDate) = '2011'
GROUP BY strftime('%Y', InvoiceDate);