To retrieve data from tables, we use the SELECT statement as follows:
SELECT name FROM musicians;
The SELECT command takes a column or comma-separated list of columns followed by a FROM clause, which specifies the table or tables containing the specified columns. This query asks for the name column from the musicians table.
Its output is as follows:
name |
Bill Bruford |
Keith Emerson |
Greg Lake |
Robert Fripp |
David Gilmour |
Instead of a list of columns, we can also specify an asterisk, which means all columns as shown in the following query:
SELECT * FROM musicians;
The preceding SQL query returns a following table of data:
ID | name | born | died | main_instrument |
4 | Bill Bruford | 1949-05-17 | ||
2 | Keith ... |