USE – Select a database in SQL

Before you can start querying a database you will need to select the database first.

This is done using the USE command

USE Enteryourdatabasenamehere

For example

USE AdventureWorks

This will change the queried database to AdventureWorks

SQL – Hello World

In a time-honoured tradition in every programming language the first thing they teach you is how to get the system to put ‘Hello World’ on to your screen.

This is accomplished by using the below command.



Play about with the PRINT command and see what else you can get the system to reproduce.

SELECT – The basis of the SQL language

The SELECT query is the basis of SQL and is the most commonly used syntax within SQL.

SELECT basically means retrieve.

For example the query SELECT 1 returns 1.


SELECT ‘This is an example of the SELECT statement’


As you can see the SELECT query is simply retrieving the number or word and returning that as a result.

If you want information from a database within a table then you must select a database and table.


Welcome to my blog – Parv The IT Geek

Hi everyone.

My name is Parvinder Nijjar and I work as a  Microsoft SQL Server Database Administrator (DBA).  I am certified at MCITP level for SQL Server and have almost seven years of experience with Database technologies.

I have a huge love of Windows Server, SQL Server, C#, C++, Python and PowerShell. I hope that through this blog that I’ve created I can help spread SQL knowledge to everyone so that they can improve their SQL knowledge and become better data professionals.

Throughout this blog I will share my knowledge and experiences of Indexing, Policy Based Management, Replication, Mirroring, Clustering, Availability Groups, Log Shipping, Backup and Restore, SQL internals, Security, SSAS, SSRS, SSIS best practices and programming.