Retrieving All Columns of a Table
Consider the following scenario: A store manager wants to retrieve information about all the categories of items available in PACKT_ONLINE_SHOP
in order to see where a new product fits in best. To retrieve a list of all the product categories, along with their details, run the following query:
use PACKT_ONLINE_SHOP; SELECT * FROM ProductCategories;
After executing the preceding query, you'll see the following output:
As shown in the preceding screenshot, the query has selected and retrieved all the records from all the columns of the ProductCategories
table, which was taken from PACKT_ONLINE_SHOP
.
Note
There are some cases where you can use the SELECT
statement without needing to use the FROM
part. For instance, to call a function, you only need to use the SELECT
statement:
SELECT GETDATE();
We will discuss functions in further detail in the upcoming chapters of...