557 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 five 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. |
Now that you know the basics of writing queries in SQL Server Management Studio here are a couple of techniques that can help speed up the process.
When you're working with large tables and you want to include all of the columns in a query it can be annoying to have to type out all of the column names. To avoid this you can use the asterisk symbol to show all of the columns in a table:
Replace the normal column names with the asterisk symbol in the SELECT list.
This is a quick and simple way to include all of the table columns, but it does mean that you can't add aliases to the columns and you have no control over the order in which the columns appear.
There are other good reasons not to use the asterisk to select all of the columns from a table, one of which is the performance of your query.
Rather than using the asterisk to include all of the columns from a table you can choose to script a table as a query. To do this, right-click on the table and choose the option shown in the diagram below:
Right-click on the table and choose the sequence of options shown here.
You will end up with a new query window and a complete SELECT statement that includes all of the columns from the selected table:
You can now remove any columns you don't want, put the columns in a different order and add your own aliases.
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.