Implementing the Database

Learn to create SQL Server database.

In this section, we are going to create a SQL Server database for our Q&A app. We will then create tables in the database that will store questions and answers. After that, we will create stored procedures that read and write records in these tables.

Creating the database

We are going to create the database using SQL Server Management Studio (SSMS) by carrying out the following steps:

  1. Open SSMS and connect to the SQL Server instance:

Press + to interact
Connecting to SQL Server Express
Connecting to SQL Server Express
  1. In “Object Explorer”, right-click “Databases” and click the “New Database”… option.

  2. Enter “QandA” for the name of the database and click “OK”:

Press + to interact
Creating the Q&A database
Creating the Q&A database
  1. Once the database has been created, we’ll see it listed in “Object Explorer”:

Press + to interact
The Q&A database in Object Explorer
The Q&A database in Object Explorer

Nice and easy! We are going to create database tables for the questions and answers in the following section.

Creating database tables

Let’s create some tables for the users, questions, and answers in our new database in SSMS:

  1. Copy the contents of the SQL ...