mysql>
mysql>
mysql> CREATE TABLE IF NOT EXISTS hotels
-> (
-> name VARCHAR(25) PRIMARY KEY, street VARCHAR(25),
-> city VARCHAR(25), state VARCHAR(25), zip INT
-> );
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> INSERT INTO hotels (name, street, city, state, zip)
-> VALUES ("Las Vegas Hilton", "3000 Paradise Road",
-> "Las Vegas", "Nevada", 89109);
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> SELECT CONCAT(name, ", ", state) FROM hotels;
+---------------------------+
| CONCAT(name, ", ", state) |
+---------------------------+
| Las Vegas Hilton, Nevada |
+---------------------------+
1 row in set (0.00 sec)
mysql> SELECT CONCAT_WS(",\n", name, street, city, state, zip)
-> FROM hotels;
+----------------------------------------------------------------+
| CONCAT_WS(",\n", name, street, city, state, zip) |
+----------------------------------------------------------------+
| Las Vegas Hilton,
3000 Paradise Road,
Las Vegas,
Nevada,
89109 |
+----------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>
mysql> DROP TABLE hotels;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>