Lab Work SQL
Lab Work SQL
Create 3 tables:
1. users
2. cats
3. details
Table 1: users
Table 2: cats
+----------+-----------------------+------+-----+---------+-------+
+----------+-----------------------+------+-----+---------+-------+
+----------+-----------------------+------+-----+---------+-------+
+---------+----------+
| user_id | cat_name |
+---------+----------+
| 4 | Preety |
| 4 | Guy |
| 4 | Lion |
| 5 | Blue |
| 5 | Red |
| 5 | Green |
| 5 | Black |
| 5 | Grey |
| 5 | Silver |
| 6 | Cat |
| 7 | Honey |
| 7 | Bunny |
| 7 | Cutie |
+---------+----------+
+-----------------+-----------------------+------+-----+---------+-------+
+-----------------+-----------------------+------+-----+---------+-------+
+-----------------+-----------------------+------+-----+---------+-------+
6. Show all the user’s first name, address that are currently staying in Selangor.
7. Show all the user’s last name, cat name that allocate their money for cat between 100 to
300.
8. Show all John’s cat name.
9. Show Grey’s owner first name and address.