563 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Basic SQL Queries Part one of a five-part series of blogs |
---|
This blog teaches the absolute basics of writing queries in Microsoft SQL Server Management Studio. You'll learn how to use the SELECT and FROM keywords to create simple queries showing all of the records from a single table.
This blog is part of our complete SQL tutorial. Alternatively, have a look at our SQL training courses for small groups. |
This blog teaches you how to write the most basic of SQL queries and will introduce you to some good habits that are worth getting into early on in your query-writing career. If you haven't already done so, now is the time to open SQL Server Management Studio and get ready to start querying.
Before you can start writing a query you need to create a new query window. There are several ways to do this, but whichever method you choose it makes sense to select the database on which you'll be running the query first:
Use the Object Explorer window to select the database you want to use. Here we've clicked on the name of the Movies database.
Once you've selected the database you can create a query window in one of several ways:
Look for this button at the top left of the screen.
Choose this option to create a new query window.
Right-click on the database you want to use and select the option shown here.
Whichever method you choose you should see a new query window appear with a flashing text cursor in the top left corner.
You should also see the name of the selected database in the drop down list on the toolbar.
You can use comments to explain what your query does to other users, or even yourself when you come back to look at your code later. You can add a comment to any line in your query by typing in two dashes, as shown below:
After typing in two dashes you can start typing your comment.
You can also add comments over multiple lines, as shown in the diagram below:
Use /* symbols to start a multi-line comment and */ symbols to end it.
Although it takes time, adding comments to your SQL code is a good idea, especially when you're first learning the language.
Now that you have a query window with a basic comment you can start writing the actual query! Read the next part of this blog to find out what to write.
Parts of this blog |
---|
|
Some other pages relevant to the above blogs include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2023. All Rights Reserved.