Sample SQL Server Database for Learning SQL

1- Introduction

LearningSQL is a small database, used as an example in the instructions of learning SQL on the website of  o7planning. There are 3 version on Databases:
  • Oracle
  • MySQL
  • SQLServer.
In this document, I will instruct you to create this database on SQLServer.
This database is provided as a sample database for learning SQL Server at:

2- Download Script

Download script at:
Direct Mediafire
Download Download
With SQLServer, you just need to care about the file:
  • LearningSQL-SQLServer-Script.sql

3- Run Script

3.1- Create SCHEMA LearningSQL in SQLServer Management Studio

Create Database
  • Database Name: learingsql
Copy content of LearningSQL-SQLServer-Script.sql into SQL Window and execute:

4- Overview LearningSQL

LearningSQL is a small database simulating the data of a bank:
Table Name Description
ACCOUNT The table saves the bank accounts. Each of customer can register multiple accounts each of which corresponds to a product type provided by the bank.
(See more: PRODUCT)
ACC_TRANSACTION The table saves the transaction history between the bank and a certain account.
BRANCH The branch of bank.
BUSSINESS  
CUSTOMER The table of customers
DEPARTMENT The department table of bank
EMPLOYEE The employee table of bank
OFFICER  
PRODUCT The products and services of bank, such as:
  • Savings account
  • The business lines of credit
  • The loans to small business
  • .....
PRODUCT_TYPE The types of products and services, such as:
  • Bank acounts
  • Loans to individual and business
  • The provider of insurance.

5- The structure of the tables

5.1- ACCOUNT

5.2- ACC_TRANSACTION

5.3- BRANCH

5.4- BUSINESS

5.5- CUSTOMER

5.6- DEPARTMENT

5.7- EMPLOYEE

5.8- INDIVIDUAL

5.9- OFFICER

5.10- PRODUCT

5.11- PRODUCT_TYPE

View more categories: