Fundamentals of Microsoft SQL Server

Installing Microsoft SQL Server

A database is one or more lists of values. A computer database is one whose values are stored in a computer medium such as a hard disk. A desktop database is one that is used in one computer. A client/server database is a database that is stored in one computer named a server and other computers named clients connect to the server to access and use the database.

Microsoft SQL Server is an application used to create computer databases for the Microsoft Windows family of server operating systems. Microsoft SQL Server provides an environment used to generate databases that can be accessed from workstations, the Internet, or other media such as a personal digital assistant (PDA).

To follow our lessons, you must have access to a computer in which Microsoft SQL Server 2022 is installed. You must also install SQL Server Management Studio. Both applications are freely available from the Microosft websites (in some cases, you can also use a computer at your work place where they would install those applications for you.

The MSSQLSERVER Service

After installing Microsoft SQL Server, you can start using it.

Because Microsoft SQL Server works as a service to the operating system, in order to use it, you must make sure its service has started. Sometimes you will have to start the service and sometimes you will have to stop it. To check it, you can open the Control Panel and the Administrative Tools. In the Administrative Tools window, open the Services.

In the Services window, check the status of the SQL Server (MSSQLSERVER), the SQL Server Agent (MSSQLSERVER), and the SQL Server Browser. When the service has started, it should be labeled Running:

Services

If the MSSQLSERVER service is stopped, you should start it. To do this, you can right-click it and click Start. If it fails to start, check the account with which you logged in. You must use the computer with a formal account and a password (some installations of Microsoft Windows allow you to use a computer without providing a username and password; in most cases, you cannot use Microsoft SQL Server without logging in using a username and a password). You should open the Settings or the Control Panel, depending on your operating syste. Access the user accounts. If necessary, create an Administrator account and create a password for it.

Opening Microsoft SQL Server

To launch Microsoft SQL Server, you can click Start -> Microsoft SQL Server Tools -> SQL Server Management Studio. When it starts, it would present a dialog box that expects you to log in. Normally, you can just click Connect, and that would open Microsoft SQL Server.

Closing Microsoft SQL Server

After using Microsoft SQL Server Management Studio, you can close it. To do this:

Connecting to Microsoft SQL Server

Introduction

In order to do anything significant in Microsoft SQL Server, you will have to establish a connection to it. If you start Microsoft SQL Server Management Studio from the Start button, the Connect To Server dialog box would come up:

Connect To Server

If you had started from the Start button but clicked Cancel, to connect to a server:

Any of these actions would display the Connect to Server dialog box.

After starting the computer and logging in, on the Connect to Server dialog box, the Database Engine option would be selected in the Server Type combo box. The name of the computer should be selected in the Server Name combo box. As an alternative, if Microsoft SQL Server is installed on the computer you are using, you can set the Server name as (local).

The easiest way to connect is to select Windows Authentication in the Authentication combo box. The User Name combo box should have the name of the computer, followed by a back slash, and followed by the user name of the account that is currently logged in. You don't have to enter a password (this is because you are using Windows Authentication and because you are logged in already).

Using the SQL Command Prompt

Besides the SQL Server Management Studio, you can also work on Microsoft SQL Server from the DOS Command Prompt. To access the command Prompt, click the Start button:

Once at the Command Prompt, type SQLCMD (case-insensitive) and press Enter.

The Command Prompt

Quitting or Exitting Microsoft SQL Server

After using Microsoft SQL Server from the command prompt, to close it, type either Exit or Quit (case-insensitive) and press Enter. To close the DOS window:

Using PowerShell

PowerShell is a command-based application. PowerShell is a free application from Microsoft. Before using it, you must have installed it. Normally, it is automatically installed with most Microsoft Windows installations; otherwise, you can freely download it from the Microsoft websites and install it.

Besides the SQL Server Management Studio and the Command Prompt, you can use PowerShell to create and manage databases. To use PowerShell:

After using the PowerShell, to exit from Microsoft SQL Server, type either Exit or Quit (case-insensitive) and press Enter.

To close PowerShell and the DOS window, you can:

Introduction to the Data Definition Language

Introduction

To write code used to perform database operations, you use a set of language tools referred to as the Data Definition Language (DDL). This language is mostly made of commands. A DDL command is code that primarily appears as regular English. There are many ways and tools available to write such code.

A Query Editor

To help you write code, Microsoft SQL Server Management Studio provides a convenient text editor. We will call it the Query Editor. To display the Query Editor:

Practical LearningPractical Learning: Ending the Lesson

  1. Close Microsoft SQL Server
  2. When asked whether you want to save, click No

Home Copyright © 2008-2025, FunctionX Last Update: Thursday 03 April 2025, 10:48 Next