Alexamara Query Solutions with output, search by using standard #number
MariaDB [textbook]> show tables;
+--------------------+
| Tables_in_textbook |
+--------------------+
| A_MARINA |
| A_MARINA_SLIP |
| A_OWNER |
| A_SERVICE_CATEGORY |
| A_SERVICE_REQUEST |
+--------------------+
5 rows in set (0.00 sec)
MariaDB [textbook]> #1. List the owner number, last name, and first name of every boat owner.
MariaDB [textbook]> describe A_OWNER;
+------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+----------+------+-----+---------+-------+
| OWNER_NUM | char(4) | NO | PRI | NULL | |
| LAST_NAME | char(50) | YES | | NULL | |
| FIRST_NAME | char(20) | YES | | NULL | |
| ADDRESS | char(15) | YES | | NULL | |
| CITY | char(15) | YES | | NULL | |
| STATE | char(2) | YES | | NULL | |
| ZIP | char(5) | YES | | NULL | |
+------------+----------+------+-----+---------+-------+
7 rows in set (0.00 sec)
MariaDB [textbook]> select OWNER_NUM, LAST_NAME, FIRST_NAME from A_OWNER;
+-----------+-----------+----------------+
| OWNER_NUM | LAST_NAME | FIRST_NAME |
+-----------+-----------+----------------+
| AD57 | Adney | Bruce and Jean |
| AN75 | Anderson | Bill |
| BL72 | Blake | Mary |
| EL25 | Elend | Sandy and Bill |
| FE82 | Feenstra | Daniel |
| JU92 | Juarez | Maria |
| KE22 | Kelly | Alyssa |
| NO27 | Norton | Peter |
| SM72 | Smeltz | Becky and Dave |
| TR72 | Trent | Ashton |
+-----------+-----------+----------------+
10 rows in set (0.00 sec)
MariaDB [textbook]> #2. List the last name and first name of every owner located in Bowton
MariaDB [textbook]> select LAST_NAME, FIRST_NAME from A_OWNER where CITY = "Bowton";
+-----------+----------------+
| LAST_NAME | FIRST_NAME |
+-----------+----------------+
| Adney | Bruce and Jean |
| Blake | Mary |
| Kelly | Alyssa |
+-----------+----------------+
3 rows in set (0.01 sec)
MariaDB [textbook]> #3. List the marina number and slip number for every slip whose length is equal to or less than 30 feet.
MariaDB [textbook]> describe MARINA_SLIP
-> ;
ERROR 1146 (42S02): Table 'textbook.MARINA_SLIP' doesn't exist
MariaDB [textbook]> describe A_MARINA_SLIP
-> ;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| SLIP_ID | decimal(4,0) | NO | PRI | NULL | |
| MARINA_NUM | char(4) | YES | MUL | NULL | |
| SLIP_NUM | char(4) | YES | | NULL | |
| LENGTH | decimal(4,0) | YES | | NULL | |
| RENTAL_FEE | decimal(8,2) | YES | | NULL | |
| BOAT_NAME | char(50) | YES | | NULL | |
| BOAT_TYPE | char(50) | YES | | NULL | |
| OWNER_NUM | char(4) | YES | MUL | NULL | |
+------------+--------------+------+-----+---------+-------+
8 rows in set (0.00 sec)
MariaDB [textbook]> select MARINA_NUM, SLIP_NUM from A_MARINA_SLIP where LENGTH <= 30;
+------------+----------+
| MARINA_NUM | SLIP_NUM |
+------------+----------+
| 1 | B1 |
| 1 | B2 |
| 2 | 1 |
| 2 | 2 |
| 2 | 3 |
| 2 | 4 |
+------------+----------+
6 rows in set (0.00 sec)
MariaDB [textbook]> #4.List the.marina number and slip number for every boat with the type Dolphin 28
MariaDB [textbook]> select MARINA_NUM, SLIP_NUM from A_MARINA_SLIP where BOAT_TYPE = "Dolphin 28";
+------------+----------+
| MARINA_NUM | SLIP_NUM |
+------------+----------+
| 1 | B1 |
| 2 | 4 |
+------------+----------+
2 rows in set (0.00 sec)
MariaDB [textbook]> #4.List the.marina number and slip number for every boat with the type Dolphin 28
MariaDB [textbook]> #5. List the slip number for every boat with the type Dolphin 28 that is located in marina 1.
MariaDB [textbook]>
MariaDB [textbook]> select SLIP_NUM from A_MARINA_SLIP where BOAT_TYPE = "Dolphin 28" and MARINA_NUM = 1;;
+----------+
| SLIP_NUM |
+----------+
| B1 |
+----------+
1 row in set (0.00 sec)
ERROR: No query specified
MariaDB [textbook]> #6.List the boat name for each boat located in a slip whose length is between 25 and 30 feet.
MariaDB [textbook]>
MariaDB [textbook]> #inclusive not stated so its can be intrepeted as MySQL between which is inclusive
MariaDB [textbook]> select BOAT_NAME from A_MARINA_SLIP where length between 25 and 30;
+--------------+
| BOAT_NAME |
+--------------+
| Gypsy |
| Anderson III |
| Bravo |
| Chinook |
| Listy |
| Mermaid |
+--------------+
6 rows in set (0.00 sec)
MariaDB [textbook]> select BOAT_NAME from A_MARINA_SLIP where length > 25 and length < 30;
Empty set (0.00 sec)
MariaDB [textbook]> #checked data all lengths 25 and 30 so its the MySQL between
MariaDB [textbook]> notee
<