Question 1
There are two tables:
![](https://xtracode.me/wp-content/uploads/2017/09/q_mysql_1_1_t1-162x300.png)
![](https://xtracode.me/wp-content/uploads/2017/09/q_mysql_1_2_t2-158x300.png)
How to get count of unique values from table t1?
1 2 |
SELECT COUNT(DISTINCT(value)) FROM t1; |
Question 2
You have the following two tables:
- book (name, volume, author_id)
- author (name, age)
How to select all books with multiple volumes and age of author greater than 50?
1 2 3 4 |
SELECT * FROM book b INNER JOIN author a ON a.id = b.author_id WHERE b.volume > 1 and a.age > 50; |