Tutorials
Search…
Lesson 4. Your First Query
We are going to pull some data from a table. The goal will be to retrieve all records from a single table with no filters, so our query will be two lines.
We will create two queries. The first query will display all columns in the table using the SQL wildcard operator '*'. The second query will display only the columns we want displayed.
Table names display in SQL Server Management Studio (SSMS) like this:
Schema.TableName
Normally, when you write your FROM clauses you can just write the name of the table. You can do that for any table in the SQL Server dbo schema. But most tables in the AdventureWorks database belong to a user defined schema so we have to include the schema name in our query.

Examples

Pull All Rows And Columns
USE AdventureWorks2016
SELECT *
FROM Person.Person
Pull All Rows But Only Certain Columns
USE AdventureWorks2016
SELECT FirstName, LastName
FROM Person.Person
Copy link