1. Write the query that would put the full name (as much of it as you know) of your favorite Star Wars character into the Person.Contact table. Use the title field to identify them as ‘SWChar’. You can use the INSERT that uses VALUES or SELECT to do this, again, extra points if you show…
Tag: SQL101
SQL 101 – INSERT
In all the previous articles I’ve written on SQL I’ve showed you how to get data out of the database. Now, we’re switching gears. I’m going to show you how to put data into the database. The command to put data into the database is INSERT. There are four main ways to use this command,…
SQL 101 – UPDATE
Previously, I showed you how to get new information into a SQL database. This time I’ll show you how to make changes to that data, once it’s in there. The basic structure of the change command is: UPDATE tableName SET columnName = ‘value’ WHERE <some test> I can’t tell you how important that WHERE clause…
SQL101-Homework Assignment #2 Answer Key
Here are my answers to the questions based on AdventureWorks. I recently updated the answers to work with the 2008R2 version of Adventureworks. If your answers are different than mine, please get in touch with me. There are always multiple ways of solving a problem, I need to make sure we’re on the same page,…
SQL101-Homework Assignment #2
SELECT with JOIN Here are a few more problems to practice with. Again, practice these queries against a copy of AdventureWorks. Now we’re going to start retrieving related data. An Employee is a Contact, but a Contact does not have to be an Employee. In adventureworks we store contacts in Person.Contact and we store employees…
SQL101-Homework Assignment #1 Answer Key
As promised, here are my answers to the first homework assignment. If you have something different, please get in touch with me so we can discuss the differences in our answers. There is always more than one way to come to the same result in SQL, but I want to make sure you have the…
SQL101-Homework Assignment #1
Here are some practice problems for you to attempt using what you’ve learned so far about SELECT Statements. Please write the following queries against any instance of Adventureworks. If you do not have access to a copy of this database, please contact me and I’ll get you credentials to connect to my training server. SELECT…
SQL 101 – JOIN
Overview I want to cover a fundamental topic for SQL programming. This is the topic you should start studying right after you have a basic understanding of what a relational database, what tables are, and that tables can be related to each other. If you’re a fan of Duct tape, then Joins will become the…
SQL 101 – GROUP BY
Consider the following table, orders. buyer productName purchaseDate qtyPurchased pricePaid ————- ————— ————— ———– ——— Shannon Lowder pencil 1/1/2000 1 .25 Shannon Lowder paper 1/1/2000 2 1.00 Shannon Lowder Mountain Dew 1/1/2000 1 1.25 Shannon Lowder pencil 1/5/2000 1 …
SQL 101 – Summarizing Data
This is the last of the lessons on functions for the 100 level. I hope you’ve enjoyed them so far, but it’s time to wrap these up! When beginning to learn SQL, it won’t be long until you have to answer questions that require you to summarize the data. It’s one of the primary reasons…