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:
@@ -0,0 +1 @@
|
||||
projectnotes.md*
|
||||
@@ -0,0 +1,2 @@
|
||||
SELECT FirstName, LastName, Country FROM CUSTOMER
|
||||
WHERE Country = 'Brazil';
|
||||
@@ -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;
|
||||
@@ -0,0 +1,2 @@
|
||||
SELECT CustomerId, FirstName, Country FROM CUSTOMER
|
||||
WHERE COUNTRY != 'USA';
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
@@ -0,0 +1,8 @@
|
||||
SELECT DISTINCT
|
||||
EMPLOYEE.FirstName, EMPLOYEE.LastName
|
||||
FROM
|
||||
EMPLOYEE
|
||||
INNER JOIN
|
||||
Customer
|
||||
ON
|
||||
EMPLOYEE.EmployeeId = Customer.SupportRepId;
|
||||
@@ -0,0 +1,5 @@
|
||||
SELECT DISTINCT
|
||||
BillingCountry
|
||||
FROM
|
||||
INVOICE;
|
||||
|
||||
Reference in New Issue
Block a user