We’re starting to cover some more difficult subjects in these homework problems. Please let me know if you need any help! 1. How many rows are there in Sales.SalesOrderHeader? 2. How many Rows are there in Sales.SalesOrderDetail, that are also in Sales.SalesOrderHeader (SalesOrderID is the common/shared column)? 3. How many sales orders (sales.salesOrderHeader) were made…
Category: Microsoft SQL
SQL 201 – CREATE TABLE
CREATE TABLE I’ve showed you how to get data out of a table, put data in, change it, and delete it. But I haven’t showed you how to create your own table….until now. CREATE TABLE tableName ( columnName <datatype> ) This statement is pretty straightforward, you have to choose the name of the table, and…
SQL101-Homework Assignment #5 Answer Key
These answers have been updated to work with Adventureworks on 2008R2. 1. Write an UPDATE query that would set your middle name, for only your record by personID. (if there is no record for you, add it in first, then show me the update to set your middle name.) UPDATE Person.Contact SET MiddleName = ‘Dwight’…
SQL101-Homework Assignment #5
Here’s another set of questions for you to practice on. As always, if you have any questions, let me know and I’ll help you. UPDATE 1. Write an UPDATE query that would set your middle name, for only your record by personID. (if there is no record for you, add it in first, then show…
SQL101-Homework Assignment #4 Answer Key
Here are my solutions updated to work with AdventureWorks on 2008R2. 1. Write a DELETE query that would remove a record from person.contact by contactID, pick a contactID that does not exist in person.contact. DELETE FROM Person.Contact WHERE ContactID = -1 2. Write a DELETE query that would remove a record from person.contact by first…
SQL101-Homework Assignment #4
Here are some more practice problems. This time you’re going to practice using DELETE. 1. Write a DELETE query that would remove a record from person.contact by contactID, pick a contactID that does not exist in person.contact. 2. Write a DELETE query that would remove a record from person.contact by first and last name. 3….
SQL 101 – DELETE
It looks like I’m getting close to the end of my 101 series. After I show you how to remove data from tables, the last topic I plan to cover is creating tables. It’s been quite a journey, collecting all this knowledge and putting it out there for you. I had hoped to get some…
SQL 101 – TRANSACTION
As I mentioned in my previous post, before you move on to more difficult topics I need to share with you what a TRANSACTION is, and how to use them. By now I’m sure you’ve seen t-SQL on tutorials. The T stands for transactional. If you don’t know what a TRANSACTION is, that’s pretty meaningless,…
SQL101-Homework Assignment #3 Answer Key
Here are the answers to the previous practice problems. 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…
SQL101-Homework Assignment #3
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…