Database Interview
View group questions.
To print this group, add it to a test.
Answer these questions using your knowledge of SQL, Relational Database Management Systems (e.g. MySQL, SQL Server, Oracle, etc.) and the sample table below.
Colors | |
---|---|
id | color |
1 | Red |
2 | Blue |
3 | Red |
4 | Green |
5 | Blue |
6 | Red |
7 | Orange |
A.
Write a query to count the number of times each color appears in the table Colors. Your output should look like this:
color | count |
---|---|
Blue | 2 |
Green | 1 |
Orange | 1 |
Red | 3 |
B.
Write a query to list the the colors in the table Colors. The output of the query should look like this:
unique colors |
---|
Blue |
Green |
Orange |
Red |
C.
Which type of sub query can be evaluated independently?
- correlated
- uncorrelated