![]() AdventureWorks2012_Data.Unzip the AdventureWorks2012_Data.zip file to a temporary folder.Locate and download the AdventureWorks2012_Data.zip file.Open the web site and click on the icon for SQL Server 2012 OLTP.AdventureWorksDW2012_Data This is the data warehouse / analytics schema for AdventureWorks.AdventureWorks2012_Data This is the OLTP Schema for AdventureWorks.Database design has progressed since AdventureWorks was first published. AdventureWorks is the OLTP sample, and AdventureWorksDW is the data warehouse sample. ![]() You may also visit the following site directly: ĪdventureWorks is the name of the fictitious Bicycle company whose database is modeled in the sample SQL Server database. The AdventureWorks databases are sample databases that were originally published by Microsoft to show how to design a SQL Server database using SQL Server 2008. From the Start menu, click All Programs, click Microsoft SQL Server 2012, click Documentation and Tutorials, and then click Microsoft SQL Server Samples Overview. For more information about installing sample databases and sample code, see the Microsoft SQL Server Community Projects & Samples ().Īdditional information about samples is available after Microsoft SQL Server 2012 has been installed. If you enjoyed this lesson, click LIKE below, or even better, leave me a COMMENT.Installing the AdventureWorks Samples in Microsoft SQL Server 2012īy default, sample databases and sample code are not installed as part of SQL Server Setup. Note now only Female employees are in the results where gender like ‘F’ – here we are filtering the results to only ones were Gender is F.Notice Start Date(HireDate) is now the first column and the records (rows) are sorted in order from oldest Start Date to newest The results will now be ordered by HireDate order by HireDate – this SQL for Sort by.select HireDate as, JobTitle as Job, BirthDate as DOB, Gender – here we reordered the fields so that HireDate appears first.select JobTitle as Job, BirthDate as DOB, Gender, HireDate as – In this case, we use the “as” command to give the field names more User friendly names.Results show the 4 columns selected above select JobTitle, BirthDate, Gender, HireDate – Here we are selecting four specific columns from the table.Now Select the next code group and click ! Execute Notice the results show every field in the table. It is not needed when executing code block by block (like we are doing here), but it is a good practice to get in the habit of adding it go – this indicates and end to the code block.from HumanResources.Employee – this is the table we want to work with.Select * – Select all fields in the table.Highlight the first group of code and click the ! Execute button One cool thing about SQL code is that you can select only the code you want to execute Select HireDate as, JobTitle as Job, BirthDate as DOB, Gender Select JobTitle as Job, BirthDate as DOB, Gender, HireDate as Select JobTitle, BirthDate, Gender, HireDate Select AdventureWorks2012 from the drop down:Ĭut and Paste the following into the new query window. Make sure you are working with the right database. Click the New Query button up top, and a new query window will open. Just picking a table at random, I selected HumanResources.Employee. Expand Databases > AdventureWorks2012 > Tables In the bottom window, highlight the log file and click Remove. Go to Object Explorer – Right Click Database > Attach… ** the portion in red changes based on what version of SQL Server you downloaded. I recommend:Ĭ:\Program Files\Microsoft SQL Server\ MSSQL12.MSSQLSERVER\MSSQL\DATA Once you have Adventureworks downloaded, you will need attach it to SQL Server.Ĭopy and paste the download file to somewhere you can find it. You can download it here: AdventureWorksDownload Microsoft provides a great sample database known as Adventure Works. Here is a link to instructions: InstallSQL A database is completely useless unless you can query the data it is holding. ![]() SELECT is doubtlessly the most important command in SQL.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |