Message from @ThisIsChris

Discord ID: 549085176626413568


2019-02-02 03:30:29 UTC  

To make a zip file, select all the files you want, right click -> send to -> compressed folder

2019-02-02 03:30:54 UTC  

The files should all be saved all ready in your project folder

2019-02-22 20:39:14 UTC  

Do we have any actuaries or CFAs in here?

Pic somewhat related. I want to work with him.

https://cdn.discordapp.com/attachments/387059792432201729/548604706436677643/Screenshot_20190222-133452_Samsung_Internet.jpg

2019-02-23 05:52:52 UTC  
2019-02-23 06:42:42 UTC  

😂

2019-02-24 03:34:53 UTC  

okay can someone help me with this?

2019-02-24 03:35:13 UTC  

Determine which books cost less than the average cost of books in the same category.List the title, the category, and the cost of these books.

2019-02-24 03:35:24 UTC  

apparently this is the answer, but I don't really get it

2019-02-24 03:35:42 UTC  

```SQL
SELECT a.title, b.category, a.cost
FROM books a,
(SELECT category, AVG(cost) averagecost
FROM books
GROUP BY category) b
WHERE a.category = b.category
AND a.cost < b.averagecost;
```

2019-02-24 03:39:19 UTC  

I see no numbers

2019-02-24 03:39:34 UTC  

it's not a math question

2019-02-24 03:39:39 UTC  

it's just SQL

2019-02-24 03:39:53 UTC  

oh ya I forgot to tag <@&435155896780324864>

2019-02-24 04:08:38 UTC  

I ended up writing my own solution like this

2019-02-24 04:09:39 UTC  

```SQL
SELECT BOOKS.Title, BOOKS.Category, BOOKS.Cost
FROM BOOKS, (SELECT BOOKS.Category, AVG(BOOKS.Cost) AverageCost
FROM BOOKS
GROUP BY BOOKS.Category) AverageCosts
WHERE BOOKS.Category = AverageCosts.Category
AND BOOKS.Cost < AverageCosts.AverageCost
```

2019-02-24 04:09:57 UTC  

idk if the first one is better

2019-02-24 04:10:12 UTC  

mine feels less convoluted

2019-02-24 04:26:18 UTC  

@Jacob I agree yours is less convoluted that the first one, but I would do
```sql
SELECT Title, Category, Cost FROM
(
BOOKS
INNER JOIN
(
SELECT Category, AVG(Cost) as avg_cost FROM
BOOKS GROUP BY Category
)
)
WHERE Cost < avg_cost
```

2019-02-24 04:26:59 UTC  

haha wow that's a lot less

2019-02-24 04:27:39 UTC  

I think our teacher wants us to get practice with subqueries on this assignment, though

2019-02-24 04:28:27 UTC  

@Jacob well the avg cost part is calculated with a subquery

2019-02-24 04:29:17 UTC  

oh that's right

2019-02-24 04:29:49 UTC  

I don't think we officially learned to do subqueries in the JOIN clause yet

2019-02-24 04:30:04 UTC  

but that looks like a better solution for the future, thanks