SQL Server Articles, SQL Server Tips, SQL Server Tutorials, SQL Server Tuning, SQL Server DBA, SQL Server Basics, Training, etc - MyTechMantra.com

SQL Server SELECT Statement T-SQL Tutorial with Examples

The SELECT Statement is used to query the data stored in a given table of a database. The data which is returned by executing the SELECT statement is referred as result-set.

Within a database data is stored within tables. In a table the data is stored in rows and columns.

In this tutorial, you will learn about Transact-SQL (T-SQL) along with relevant examples. To understand each topic in detail we recommend you to follow the sequence of articles.

This is Part 1 of 40 Part SQL Server T-SQL Tutorial.

Topics Covered in SQL Server T-SQL Tutorial are:

SELECT Syntax / SQL Server SELECT Statement Syntax

Use <DatabaseName>
GO

SELECT column1, column2, column3,.......
FROM schema.table
GO

SQL Server SELECT Statement: How to Query Data from a Table in SQL Server

How to SELECT all columns from a table

To select all the columns and data from a table execute the below SELECT Statement in SQL Server Management Studio (SSMS).

Use the below script to fetch the data from AdventureWorks2016 sample database in SQL Server 2016. For more information on How to Download SQL Server 2016 and Sample Database, refer How to Download SQL Server 2016 Developer Edition for Free.

Use AdventureWorks2016
GO

SELECT * FROM HumanResources.Employee
GO
SQL Server Select Statement How to Query a Table to Fetch Results

How to SELECT required columns from a table

To select some of the columns and data from a table execute the below SELECT Statement in SSMS.

Use AdventureWorks2016
GO

SELECT 
	  FirstName
	, LastName 
FROM Person.Person
GO
Basic Select Statement Results

We recommend you to go thought all the topics of SQL Server Transact-SQL Tutorial in the sequence for better understanding of Transact-SQL. Click Next Page button to continue reading the topics and click on the Previous Page button to revisit the previous topic.

Next Page..



Related T-SQL Tutorials

Ashish Mehta

Ashish Mehta

Ashish Kumar Mehta is a database manager, trainer and technical author. He has more than a decade of IT experience in database administration, performance tuning, database development and technical training on Microsoft SQL Server from SQL Server 2000 to SQL Server 2014. Ashish has authored more than 325 technical articles on SQL Server across leading SQL Server technology portals. Over the last few years, he has also developed and delivered many successful projects in database infrastructure; data warehouse and business intelligence; database migration; and upgrade projects for companies such as Hewlett-Packard, Microsoft, Cognizant and Centrica PLC, UK. He holds an engineering degree in computer science and industry standard certifications from Microsoft including MCITP Database Administrator 2005/2008, MCDBA SQL Server 2000 and MCTS .NET Framework 2.0 Web Applications.

Add comment

Newsletter Signup! Join 15,000+ Professionals




Be Social! Like & Follow Us...

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Recent SQL Server Tips

Manning