Blog article
Your first SQL SELECT query
Read customer names from the shared SQL Server practice database with SELECT and FROM.
A SELECT query asks SQL Server to return data. This first example reads customer names from the shared DDI_SQL_Training practice database. It does not change the stored customer rows.
Run your first query
After installing the approved practice dataset, connect to your disposable SQL Server instance in SSMS and select DDI_SQL_Training in the database dropdown. Check the selected database before executing the query below.
SELECT FirstName, LastName
FROM dbo.Customers;SELECT names the columns to return: FirstName and LastName. FROM dbo.Customers identifies the Customers table in the dbo schema. With the unmodified practice dataset v1.0.0, the result contains 20 customer rows and these two columns. A SELECT result is not a new stored table.
Read the result
Find Alex Bennett and Maya Clark in the returned names. Their position may vary because this query has no ORDER BY clause, so it does not guarantee row order. To explore another column without changing data, add CustomerID to the SELECT list and run the query again. Keep experiments in the disposable practice database, not a production or valuable database.