Skip to content
Advertisements

Bike Stores SQL Database

Summary: in this tutorial, you will learn how to create a new database in SQL Server and execute the script to load the sample database.

First, you need to download the following zip file if you have not done so:

Second, uncompress the zip file, you will see three SQL script files:

  •  BikeStores Sample Database - create objects.sql – this file is for creating database objects including schemas and tables.
  •  BikeStores Sample Database - load data.sql – this file is for inserting data into the tables
  •  BikeStores Sample Database - drop all objects.sql – this file is for removing the tables and their schemas from the sample database. It is useful when you want to refresh the sample database.

Third, let’s create a database, create the schemas and tables, and load the sample data.

Step 1

Connect to the SQL Server by (1) choosing the server name, (2) enter the user and (3) password and (4) click the Connect button.

Step 2

Right-click the Databases node in the Object Explorer and select the New Database… menu item

Step 3

(1) Enter the Database name as BikeStores and (2) click the OK button to create the new database.

Step 4

If everything is fine, you will see the database BikeStores appears under Databases node as shown in the screenshot below:

Step 5

From the File menu, choose Open > File… menu item to open a script file.

Step 6

Select the BikeStores Sample Database – create objects.sql file and click the Open button

Step 7

Click the Execute button to execute the SQL script.

You should see the following result indicated that the query executed successfully.

If you expand the BikeStores > Tables, you will see the schemas and their tables are created as shown below:

Step 8

Open the file for loading data into the tables.

Step 9

Choose the BikeStores Sample Database – load data.sql file and click the Open button.

Step 10

Click the Execute button to load data into the tables.

You should see the following message indicating that all the statements in the script were executed successfully.

step-13-result-of-the-data-load-script
step-13-result-of-the-data-load-script

source: http://www.sqlservertutorial.net/load-sample-database/

Advertisements

4 Comments »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: