For example, the query below could be used to get the birth date of the oldest employee. Answer to the questions based on the information in the Northwind database. Display the business entity ID number, the login ID, and the title for each one. Which one is good? Why create a whole database when you can use an existing one for testing purposes? If this question can be reworded to fit the rules in the help center, please edit the question. 1. Get the list of the products which doesn’t have any orders across all the months and year as, 7. Structure of 'northwind' database: MySQL Online Editor There are also many exercises kicking around, just google it I would pick up Inside Microsoft SQL Server 2005: T-SQL Querying. Get the list of the months which doesn’t have any orders for product chai, 6. Get the list of the employees who processed the orders doesn’t belongs to his own city, 11. This was a collection I felt necessary to create because of all of the different flavors of databases you can use to test without damaging your own database. Well you are not alone! See the original article here. The database contains the sales data for Northwind Traders, a fictitious specialty foods export-import company. The database contains the sales data for Northwind Traders, a fictitious specialty foods export-import company. Articles like this http://www.sommarskog.se/dynamic_sql.html are also extremely helpful, since they provide insight into how, why and why not. If you have Reporting Services handy, or even Visual Studio, creating a few reports with aggregates, sums, counts etc will give you a little insight to how data can be used as information and really boost your SQL skills. I am trying to become more familiar with SQL by writing queries against the Northwind database. If this question can be reworded to fit the rules in the help center, please edit the question. Use the Northwind Sales database. Chinook database is an alternative to the Northwind database, being ideal for demos and testing ORM tools targeting single and multiple database servers. Northwind is the name of the sample database for SQL Server 2000, that later got replaced with the AdventureWorks sample database in SQL Server 2005. Guide to Using he Northwind Database t in Access 2010, 2010). It's probably best to determine what data you find relevant and download the appropriate version. I work in a telephony company where this goes on all the time. GROUP BY clause and working with aggregate functions such as SUM, MIN, MAX, etc.. WHERE - for filtering records returned in a query, Subqueries - Subqueries and Correlated subqueries, CASE, COALESCE, BETWEEN, CONVERT, CAST functions/statements. This collection of databases is meant to show how to properly design databases and how applications use them efficiently. categoryID Note: The previous is the CORRECT form of the join. b. Find Title of employee Nancy. Finally, we have the Chinook database which represents a digital media store, including tables for artists, albums, media tracks, invoices, and customers. Whenever you encounter an issue, you can go look at the reference books (The T-SQL querying book mentioned above is a very good one) and figure out the best way of doing it. 15. Order Subtotals. It is important that the exercises have solutions, and in complicated cases, it would be great if there was an explanation for the query. The Northwind Database The Northwind database is a sample database used by Microsoft to demonstrate the features of some of its products, including SQL Server and Microsoft Access. Post your comments below and let's discuss. I recently completed a project for my Data Science program that involved analyzing data from the Northwind Database — a Microsoft sample database that … I am trying to become more familiar with SQL by writing queries against the Northwind database. Writing it in the following way will also get the same results but you might lose some points if written in the exam! The database contains the sales data for Northwind Traders, … What is its order ID ? Result : 4. select OrderID, format(sum(UnitPrice * Quantity * (1 - Discount)), 2) as Subtotal. 4. It is important that the exercises have solutions, and in complicated cases, it would be great if there was an explanation for the query. Make all queries calculate their results for the year 1995. Write an expression to determine a … a) Find all German suppliers. Additionally, if you're trying to learn SQL Server, it's a good idea to follow certain blogs. 1. Get the list of the months which doesn’t have any orders for product chai . In addition, the cross-database queries and queries using linked SQL Servers examples use SQL Server 2000 on which the Northwind and pubs example databases have been installed. Developed this stored procedure on my labs to simulate t... Pivot without Aggregating with consistent and inconsistent formats: One of the most common tasks which I came across at least once in almo... query execution in the production taking long time one of the query in the production taking almost 40 minutes instead seconds where it us... SQL Server Data Masking : Download code DataMasking.sql Masking data can be done through updating the confidential information in t... -- chandra sekhar pathivada. The following code example queries the Northwind database for the product with the ProductID value of 27. Oh, and they're also great test databases to beat on for performance scenarios. Write a query using a WHERE clause that displays all the employees listed in the HumanResources.Employee table who have the job title Research and Development Engineer. Posted 12-Nov-12 21:37pm. Opinions expressed by DZone contributors are their own. a) Find all German suppliers. Join the DZone community and get the full member experience. How many are there ? b) What products does Karkki Oy supply ? The Contoso University is an updated database to show how a schooling database would look like. For each order, calculate a subtotal for each Order (identified by OrderID). 5. What are the USA customers' IDs, names, cities, and states? You would start thinking on the lines of how to pull data out of the db, update the data , so on and so forth. Simple theme. It is important that the exercises have solutions, and in complicated cases, it would be great if there was an explanation for the query. I am trying to become more familiar with SQL by writing queries against the Northwind database. Can you give me a link to exercises if you choose between the databases? northwind database Question. Basics of relational databases Exercises with Northwind sample database. SQL Exercise on Northwind database 1-Select all product names and their category names. Write a query to count current and discontinued products. Answer to the questions based on the information in the Northwind database. Write a query to get Product list (name, units on order , units in stock) of stock is less than the quantity on order. Microsoft SQL Server 2008 Database Development Training Kit so may still be relevant for users trying to learn SQL essentials. As before, the database connection is opened and closed automatically by the DataContext object. I won't post the final answer to your homework exercise but you should become familiar with the ... ORDER BY construct. c) Which order has the biggest subtotal ? Add a typed DataSet using a new data source that connects to the Northwind sample database. 1. ... (Since the answer will depend on the day you run the query, you do not need to show your result.) AdventureWorks Cycles is another classic database representing a fictional company created and published by Microsoft. Here is a screenshot of the queries from Access Northwind database. Basics of relational databases Exercises with Northwind sample database. ... please tell me any site which have collection of queries on any microsoft database like Northwind,AdventureWorks,pub etc for practice ...Please help me.. thanks in advance. categoryID = categories. Get the list of employees who processed the order “chai”, 8. on northwind database schema Thank you, I really appreaciate your answer. Today, I've collected a list of sample databases for SQL Server. Introduction to the Northwind Database The Northwind database is a sample database used by Microsoft to demonstrate the features of some of its products, including SQL Server and Microsoft Access. Make sure you start with a problem you want to solve (i.e. Go to the editor. Another version exists at Microsoft SQL Server Samples GitHub. Click me to see the solution ... More. It's been a while since I've done a collection post, so I thought this would be perfect. Select the database objects (customers, orders, order details, products, categories, and suppliers) tables. Update         statement must contains Join. (Use a sub-query) 4. -- Get subtotal for each order. Isn't it a good idea to choose Microsoft's databases such as Northwinds , pubs , AdventureWorks. Click me to see the solution. 1. But in my opinion, unless you really face a problem and solve it on your own, the fundamentals don't stick into your head. To get list of all the orders processed with category name as an input parameter, 2. There is also a sample script of how to create it. Powered by, Also check practice queries on PUBS database, Download the Northwind database from the below link, sql server queries taking long time to execute in production. The … The Northwind Database works with SQL Server 2005 and 2008 and was originally created for demonstration purposes for Microsoft Access. How many customers are in the USA? What better way than to use production...err...I mean, a test database? Ans. practice queries on pubs database Also check practice queries on northwind database. b) What products does Karkki Oy supply ? We have tried to visit many forums and blogs to gather Questions related to Complex SQL Queries and provide them to you in this series of blog post on Complex SQL Queries … Basic Queries of SQL Server Database Management Studio 1. No need to be fancy, just an overview. yet. 2. 3. Get the list of the employees and the count of orders they processed in the month of “march “across all the years, 9. There are times when you need a sample database to test out a query or benchmark the database or server in general. It eventually transitioned over to SQL Server. The value returned is an instance of the Product class, and the Console.WriteLine statement prints the name of the product. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. The Northwind database has shipped with Access since the earliest versions, with every new release of Access up to Access 2007 providing an updated version of This database supports not only SQL Server, but DB2, EffiProz, MySQL, Oracle, PostgreSQL, SQL Server Compact, and SQLite Data Model. How may Orders did customers in Washington place? It's a simple database example. sample database named Northwind, which can be installed complete with tables (containing data), queries, sample forms, reports, macros, and VBA object classes, functions and modules. 2. Before you follow the examples, to ensure that you see the same results … I am looking for some exercises that would help me to learn SQL and features of SQL Server. Get the list of the months which doesn’t have any orders  like  below ( This is a typical question , design the code before you execute carefully), Hint : Below Example is for the products which are doesn’t have any orders for certain years, select distinct P_CROSS_Y.productid,P_CROSS_Y.productname,P_CROSS_Y.y,PY.ORDER_YEAR  from (select top 1000 productid,productname,y from products cross join years order by 1,2) P_CROSS_Yleft outer join (select distinct productid ,datepart(year,O.orderdate)  as ORDER_YEAR from [order details] od join orders o on od.orderid = o.orderid ) PYon P_CROSS_Y.productid = py.productid and P_CROSS_Y.y = py.ORDER_YEARwhere py.ORDER_YEAR  is null, 4. It can be created by running a single SQL script. 1. Published at DZone with permission of Jonathan Danylko , DZone MVB. c) Which order has the biggest subtotal ? Get the product name , count of orders processed, 3. 10. The database is segmented into three downloads: Each one has certain tables included like badges and post history. Thanks for the answers so far but I still have not found what I am looking for:Is there any free resource, available online, without registration, that I can find a list of these exercises? surendra00. I am looking for some exercises that would help me to learn SQL and features of SQL Server. This book is great and has exercises + answers, I did an interview with the author a while back about this book, you can find that here: Interview With Itzik Ben-Gan Author Of Inside Microsoft SQL Server 2005: T-SQL Querying. For a few simple problems/exercises:http://caml2010.wordpress.com/2010/06/12/northwind-exercise/. What are the 5 most expensive products? 6. Please order the data by State and City. Did I miss a database? The database shows how to design a SQL Server database using SQL Server 2008 and AdventureWorksDW is the data warehouse sample. Step A.1: Create an “Extended Order Details” Query The Northwind Traders database contains two tables which store details about customer orders: • Table “Orders” contains “fixed” information about each order, such as customer Get the list of the products which doesn’t have any orders across all the months and year as How many are there ? c. Separate your queries as I have done in the following example. I first found out about this through Brent Ozar's post on How to Download the StackOverflow database via BitTorrent. What is its order ID ? The best way to learn in my opinion would be to work on a small hobby project. It works with 2005, 2008, 2008R2, 2012 RTM, and Azure. Aim : Master SQL Server 2008 using Microsoft's databases. The Northwind Traders sample database in Microsoft Access 2010 contains transactional data for a fictitious company that imports (purchases) and exports (sells) specialty foods from around the world. Be sure to include the query you used along with the results [answers] to the questions. Those blogs will often have queries based on AdventureWorks. Go to the editor. Add a Solution. As it currently stands, this question is not a good fit for our Q&A format. Get the top 3 products which has more orders, 5. 3. Get the top 3 products which has more orders . This is the part 2 of Complex SQL Queries For Practice as discussed in our first post on Complex SQL Queries. Create a SQL Script that answers the following questions about the Northwind database (see the attachment): 1. what is the average order amount for people who live in WA in the Northwind database?). (Answer set=77 rows) SELECT productname, categoryname From products inner join categories on products. However, it is still used in e.g. This is case study of 15 SQL Queries based on Northwind Database ... Northwind database exercise. Practice Query on Northwind Database. Toy examples,exercises are good. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. I am looking for some exercises that would help me to learn SQL and features of SQL Server. Get Order id, Product id, Unit price from Order Details. Write something about yourself. Write good, clean SQL that answers the following questions. Write an SQL query to print the first three characters of FIRST_NAME from Worker table. Create your own unique website with customizable templates. stored procedure to generate BCP scritps to migrate the SQL Server database. Which one is your favorite? The assignment is in two parts. For those unfamiliar with Access, a great tutorial. End each query with a semicolon (;) and insert the word "go" between each query. Get the shipper company who processed the order categories “Seafood”, 12. 5. MySQL Exercises, Practice, Solution: MySQL is the world's most widely used open-source relational database management system (RDBMS), enabling the cost-effective delivery of reliable, high-performance and scalable Web-based and embedded database applications 3. Joins - INNER and OUTER (difference between LEFT and RIGHT JOIN). Chinook is a sample database available for SQL Server, Oracle, MySQL, etc. Also check out this link http://www.sql-server-performance.com/tips/related_web_links_p1.aspx. Nothing like an old classic to kick off the list. Get the list of the employees who processed the orders belongs to his own city, 10. I am looking for a tutorial where I get a lot of exercises to do, so that I can master SQL Server 2008. Northwind Database Exercises for Mongo. For instance, lets say you are interested in sports, pick up your favorite sport and envision how you would model the sport statistics in the most elegant way in the form of a SQL database. A few things to focus on that will exercise a lot of areas of SQL that you should know if you're going to be writing a lot of it: Find a good data set and try to run some meaningful queries on it. Answer to Using the Northwind database, provide MySQL queries for the following. Get category name , count of orders processed by the USA employees, Get the supplier name , shipper name for product category “sea food”Add one more column to the Employees Table as "Bonus"       and update the bonus field with number of total number orders each employee processed. (Hint: A subquery is not required.) Make sure the TableAdapters are stored in the Data Access tier and the DataSet class is … This is a simple query using GROUP BY to aggregate data for each order. Use the AdventureWorks2008 database to complete this exercise. Since the script is simple enough, it should work on every SQL Server. a. I have also provided a data dictionary (Excel file) that describes each of the tables. Part one is to develop mongo queries for each of the following exercises. Additionally, the database can be downloaded for SQL Server 2000 from Microsoft (Northwind and Pubs Sample Databases for SQL Server 2000, 2010) and for SQL Server 2005 and 2008 from Codeplex (Northwind atabase, D 2011). I have this book sitting on my desk which I have found really handy. All questions are based on the Northwind database. Northwind Database Exercise The Northwind database is a sample database used by Microsoft to demonstrate the features of some of its products, including SQL Server and Microsoft Access. Chai ”, 12 exists at Microsoft SQL Server homework Exercise but should! To design a SQL script that answers the following questions tutorial where i get a lot of exercises to,! Chai, 6 the top 3 products which has more orders, 5 join ) 's... Query or benchmark the database objects ( customers, orders, 5 order by construct what! Each one AdventureWorks Cycles is another classic database representing a fictional company created and published by Microsoft familiar SQL... The word `` go '' between each query with a semicolon ( ; ) insert! Is an alternative to the questions based on the information in the following example that can... Sample script of how to Download the StackOverflow database via BitTorrent inner categories... Export-Import company great test databases to beat on for performance scenarios, i 've done a post. As Northwinds, pubs, AdventureWorks want to solve ( i.e have done in the exam the name the. T-Sql Querying 's post on how to create it and closed automatically by the object! Benchmark the database contains the sales data for Northwind Traders, a fictitious specialty foods company..., just an overview on every SQL Server a while since i 've collected a list of the which. The databases Danylko, DZone MVB improved and possibly reopened, visit the help,... About the Northwind database exercises for Mongo sample databases for SQL Server database provided a data dictionary ( Excel ). The … create a SQL Server 2008 's a good idea to choose Microsoft 's databases such as Northwinds pubs... Learn SQL essentials small hobby project while since i 've done a collection,! Access, a fictitious specialty foods export-import company their category names Danylko, MVB... Worker table northwind database query exercises with answers of the oldest employee ) and insert the word `` go '' each! Off the list customers, orders, 5 good idea to choose Microsoft 's databases such as Northwinds,,... Database exercises for Mongo scritps to migrate the SQL Server will depend on the information the... Help center for guidance Download the appropriate version on how to properly design and! Contains the sales data for Northwind Traders, … SQL Exercise on Northwind database all! Order categories “ Seafood ”, 12 i thought this would be perfect and. Please edit the question sure to include the query, you do not need to show how design... Mean, a fictitious specialty foods export-import company live in WA in the Northwind database schema Thank,. Dataset using a new data source that connects to the Northwind database, being ideal for and! Existing one for testing purposes is also a sample script of how properly... Go '' between each query ) select productname, categoryname from products inner join categories products! Desk which northwind database query exercises with answers have found really handy who live in WA in the database! Another version exists at Microsoft SQL Server and their category names off the list of the oldest employee be to. Set=77 rows ) select productname, categoryname from products inner join categories products!, just an overview by writing queries against the Northwind database t Access. The database objects ( customers, orders, order Details: http: //www.sommarskog.se/dynamic_sql.html are also extremely helpful, they... Sql queries for each order ( identified by OrderID ) member experience a problem you want to solve (.! The DataContext object Samples GitHub ) and insert the word `` go '' between each query with a you! Via BitTorrent, … SQL Exercise on Northwind database an instance of tables... Rules in the following exercises migrate the SQL Server in general 2005 and 2008 and was created! Include the query, you do not need to show how a schooling database look! The following questions across all the orders belongs to his own city 10. And they 're also great test databases to beat on for performance scenarios database: MySQL Online Editor Basics relational. Since i 've done a collection post, so that i can master SQL Server.... For each order ( identified by OrderID ) the DZone community and get the same results but you lose... To design a SQL Server 2005 and 2008 and was originally created for demonstration for... Extremely helpful, since they provide insight into how, why and why not test databases to beat on performance! For each one edit the question Unit price from order Details order ID product... From Worker table queries on pubs database also check practice queries on Northwind database 1-Select product... €¦ create a SQL Server northwind database query exercises with answers database Development Training Kit so may still be relevant for trying... Category name as an input parameter, 2 ) as subtotal this through Brent Ozar 's post on SQL... Access, a great tutorial Excel file ) that describes each of the questions... //Www.Sommarskog.Se/Dynamic_Sql.Html are also extremely helpful, since they provide insight into how, and. Ids, names, cities, and Azure to kick off the list of sample databases for SQL.! Use them efficiently the name of the months and year as yet out this... Certain tables included like badges and post history SQL Exercise on Northwind database, being ideal for demos and ORM... Test out a query or benchmark the database is an instance of the tables the data sample... One is to develop Mongo queries for each of the products which doesn’t have any orders across the. The join answer set=77 rows ) select productname, categoryname from products inner categories! Print the first three characters of FIRST_NAME from Worker table birth date of the queries from Access Northwind database,! Not a good fit for our Q & a format in my opinion would perfect... Aggregate data for Northwind Traders, … SQL Exercise on Northwind database really! Provided a data dictionary ( Excel file ) that describes each of the tables pick up Inside Microsoft SQL,. Practice as discussed in our first post on Complex SQL queries contains the sales data for Northwind,... To use production... err... i mean, a fictitious specialty foods export-import.! For people who live in WA in the following questions about the Northwind database targeting single and multiple database.!... ( since the script is simple enough, it should work on every Server. Better way than to use production... err... i mean, a great tutorial and and... Thought this would northwind database query exercises with answers to work on a small hobby project one has certain included. Products inner join categories on products to count current and discontinued products this of! Just an overview Access Northwind database how, why and why not single. You start with a semicolon ( ; ) and insert the word `` go '' between query! Testing purposes me to learn SQL and features of SQL Server 2008 database Development Kit... Of databases is meant to show your result. can you give me a link to exercises if you trying! A fictional company created and published by Microsoft SQL script RTM, and the title for order... The orders doesn ’ t belongs to his own city, 10 not need to fancy... A subtotal for each order lose some points if written in the Northwind database ( see the ). To Download the appropriate version aggregate data for Northwind Traders, … SQL Exercise on Northwind database and history! Create it exercises to do, so that i can master SQL Server the SQL Server Samples GitHub Contoso!, … SQL Exercise on Northwind database current and discontinued products center for.! Want to solve ( i.e characters of FIRST_NAME from Worker table form of the oldest employee of. Order “ chai ”, 12 the list of employees who processed orders... Done a collection post, so that i can master SQL Server database using SQL Server ID... Do, so i thought this would be perfect ) ), 2 and was originally created for purposes... Contains the sales data for Northwind Traders, a fictitious specialty foods export-import company member experience or... Make all queries calculate their results for the year 1995 queries against the Northwind sample.. Of Jonathan Danylko, DZone MVB tools targeting single and multiple database servers orders for product chai, 6 part... Is simple enough, it 's probably best to determine what data you relevant.: http: //www.sommarskog.se/dynamic_sql.html are also extremely helpful, since they provide insight into how, and... Ids, names, cities, and the Console.WriteLine statement prints the name of the join date of the...., Unit price from order Details, products, categories, and northwind database query exercises with answers write a query to current. Top 3 products which has more orders and was originally created for demonstration purposes for Access! Doesn ’ t belongs to his own city, 10 guide to he! Calculate their results for the year 1995 any orders for product chai, 6 ( Hint: a subquery not! Belongs to his own city, 10 title for each order, calculate a subtotal for each order to (... Sample database to test out a query to count current and discontinued products you choose the! Based on the information in the exam 's probably best to determine a … database. Product name, count of orders processed, 3 to include the query, you do need! Exercises that would help me to learn SQL Server 2008 and AdventureWorksDW is the average order for... ) that describes each of the following way will also get the same results but you might some. Brent Ozar 's post on how to create it a screenshot of the product class, and?. Between LEFT and RIGHT join ) published at DZone with permission of Jonathan Danylko DZone...