Database Reference
In-Depth Information
A common <what> condition is to grab everything. This is done using an asterisk ( * )
as follows:
MariaDB [test]> SELECT * FROM employees;
+----+----------+---------------+-----------+------------+
| id | surname | givenname | pref_name | birthday |
+----+----------+---------------+-----------+------------+
| 1 | Taylor | John | John | 1958-11-01 |
| 2 | Woodruff | Wilford | Will | 1957-03-01 |
| 3 | Snow | Lorenzo | NULL | 1964-04-03 |
| 4 | Smith | George Albert | George | 1970-04-04 |
| 5 | McKay | NULL | NULL | NULL |
+----+----------+---------------+-----------+------------+
5 rows in set (0.00 sec)
However, when our table contains lots of columns, we probably will only want to
select certain of them. To do so we list the columns, separated by commas, in the
<what> section. For example, we could select just the preferred names and surnames
as follows:
MariaDB [test]> SELECT pref_name,surname FROM employees;
+-----------+----------+
| pref_name | surname |
+-----------+----------+
| John | Taylor |
| Will | Woodruff |
| NULL | Snow |
| George | Smith |
| NULL | McKay |
+-----------+----------+
5 rows in set (0.00 sec)
 
Search WWH ::




Custom Search