This Tutorial
- Using SQL to create a SQL Server database
- Using SQL to access SQL Server databases
- Using SQL to describe SQL Server database tables

Related Pages
Microsoft Access Workgroup tutorial
Microsoft Access Database Splitter tutorial
Microsoft Access Build Your Own Database manual
- SQL tutorial for MySQL
- SQL tutorial for Microsoft Access
SQL database comparisons
- Comparison of the commands and operators used in WHERE clauses in Oracle, Microsoft Access, MySQL and SQL Server, and how to limit the number of rows returned
- Comparison of useful functions in Oracle, MySQL, Microsoft Access and SQL Server

Structured Query Language (SQL) tutorial

Using SQL to Create a SQL Server Database

We'll create a database called bus that contains details of bookings for our company XYZ Transport. The details we plan to store include customer names, dates and times, buses, destinations, customer and drivers' addresses, phone numbers etc.

Both the MSDE server and client need to be running for you to work with your database.  The MSDE server started when you logged in to Windows because it was installed as a service.  You need to start the application that you are using as a client to connect to the database (SQL Buddy).  To do this:

  • Select Start > All Programs > SQLBuddy.  The Connection Profiles Window opens:
SQL Buddy connection profiles
  • Click Add. The Edit Connection Profile dialog will open.
SQL Buddy Edit Connection dialog
  • Enter your given name in the New Profile textbox (1).
  • Right-click My Computer on your computer’s Start menu
  • Select Properties from the shortcut menu to reveal your computer’s System Properties information box.
  • Select the Computer Name tab.
Windows' System Properties dialog
  • Enter the computer name on this tab into SQL Buddy’s Edit Connection Profile dialog as the name of your MSDE / SQL Server (2).
  • Check Use trusted Connection (3).
  • Test your connection (4 ). You will be advised whether your test succeeded or not. If not, check your computer name and try again.
  • Once you have successfully set up a profile, close the Edit Connection Profile dialog. Your new profile has been added to the Connection Profiles.
The new connection profile added to the connection profiles

Now that your have established your profile, you can connect to MSDE by double-clicking your profile.

After you connect to the server, you can create a database, as follows:

  • Type

   create database bus;

Remember that all SQL commands must end with a semi-colon (;). 

  • Click the Run button, SQL Buddy Run button.

The MSDE server responds with something like

   Statement Completed Succesfully
   Local Execution Duration (ms): 734
   Last Run: 11:18 AM
   The CREATE DATABASE process is allocating 0.63 MB on disk 'emp'.
   The CREATE DATABASE process is allocating 0.49 MB on disk 'emp_log'.

This means that you have successfully created the database.

Now, let's see how many databases you have on your system.

  • Issue the following command.

   sp_databases;

The server responds with a list of databases:

List of databases

(Some of the databases have been obscured in this figure. This should not be the case for your server)

Here we have several databases, some created by MSDE during installation and our bus database.You should see your newly-created bus database on this list.


  • Home
  • |
  • Sitemap
  • |
  • Databases
  • |
  • Web development
  • |
  • Delphi development
  • |
  • Image manipulation
  • |
  • KaSaB
  • |
  • Contact