SQL Server 101 – Podcasts 011 and 012
Find out more about the SQL Server 101 Podcast.
In Episode 11 of the SQL Server 101 podcast, we look at the following topics:
Creation of the Employee Table
In the previous few podcasts, we learned all about the different data types, whether they be number, string or date. Now that we know all about these, we can now create an Employee table.
We’ll go through the syntax of the CREATE TABLE, and have a look at the various fields that we are going to create, and work out what data types might be appropriate for each. Some data types might not be wide enough (they might be able to contain sufficient information); some might be too wide (do you need to record down to a 1/300th of a second when storing Date of Birth?)
Objectives for Sessions 3-4
In this section, we’ll have a look at the various objectives for future episodes of the podcast. In the new few episodes, we’ll be looking at the SELECT statement. We’ve already looked at SELECT and FROM; we’ll be adding WHERE, GROUP BY, HAVING and ORDER BY, together with a few JOINs.
Adding additional columns
We’ll then alter the Employee Table, by adding additional columns. Instead of dropping and recreating the table, we can use the ALTER TABLE statement to add additional fields.
We’ll add some new data into the table, and see what happens if you create a field that is not wide enough, and add wider data into it.
L Server 101 podcast, we look at the following topics:
WHERE queries – string
Previously our SELECT statement retrieved the entirety of the table – all of the rows (but not necessarily all of the columns). What if we only want a selection of the rows? This is where the WHERE keyword comes in.
We’ll have a look at all employees with the last name “Word”, and then words later in the alphabet, and words earlier in the alphabet.
We’ll then have a look at where a field contains a word or part of a word – for example, all employees where the last name contains the letter W.
WHERE queries – number
Just as we can limit the number of rows by searching on a string column, we can also search on a number field.
We’ll have a look for a particular Employee Number, and those in a range (BETWEEN two numbers). We’ll then have a look for multiple values (for example, 200, 202 or 204).
If you liked this podcast, why not subscribe on iTunes?