SQL Exercises, Practice, Solution - exercises on AdventureWorks Database
SQL Queries of AdventureWorks Database:
The AdventureWorks Database is a Microsoft product sample that provides an example of an online transaction processing (OLTP) database. Adventure Works Cycles is a fictitious multinational manufacturing company that is supported by the AdventureWorks Database.
Exercises:
List of Schemas and Tables and ER Diagram in the AdventureWorks database:
Schema: humanresources
E R Diagram of humanresources Schema:

Schema: person
- address
- addresstype
- businessentity
- businessentityaddress
- businessentitycontact
- contacttype
- countryregion
- emailaddress
- person
- personphone
- phonenumbertype
- stateprovince
E R Diagram of person Schema:

Schema: production
- location
- illustration
- productcategory
- productcosthistory
- productlistpricehistory
- productmodelproductdescriptionculture
- productreview
- scrapreason
- productsubcategory
- transactionhistory
- transactionhistoryarchive
- productmodelillustration
- unitmeasure
- productmodel
- workorderrouting
- billofmaterials
- productdescription
- productdocument
- culture
- product
- productphoto
- productinventory
- productproductphoto
- workorder
E R Diagram of production Schema:

Schema: purchasing
E R Diagram of purchasing Schema:

Schema: sales
- salesorderheadersalesreason
- customer
- countryregioncurrency
- currencyrate
- creditcard
- specialoffer
- specialofferproduct
- currency
- store
- personcreditcard
- salestaxrate
- salespersonquotahistory
- salesreason
- salesterritoryhistory
- salesterritory
- salesperson
- salesorderheader
- salesorderdetail
- shoppingcartitem
E R Diagram of sales Schema:

Download Postgre verseion of AdventureWorks Database. Clickhere.
SQL: Tips of the Day
Date from a SQL Server DateTime datatype
SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, @your_date))
for example
SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))
gives me
2008-09-22 00:00:00.000
Pros:
- No varchar<->datetime conversions required
- No need to think about locale
Database: SQL Server
Ref: https://bit.ly/3I8V4lm
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises