Create a Database in SQL Server 2017
Here's how create a database in SQL Server using SQL Operations Studio.
Creating a database in SQL Server is as easy as running a script. Some GUI database management tools enable you to create a database via the GUI (i.e. by "pointing and clicking") instead of running a script, but usually those GUI tools also provide the means to do it via a script.
In this tutorial, we'll create a database by running a script.
Connect to SQL Server
Regardless of which database management tool you use, you still need to connect to SQL Server. We'll do that first.
Launch your Database Management Tool
Launch your database management tool if you haven't done so already.
In this tutorial we use SQL Operations Studio. You can launch SQL Operations Studio the same way you'd launch any other application in your operating system. For example, in macOS click its icon in your Applications folder, or in Windows double-click sqlops.exe in the sqlops-windows folder.
Connect to SQL Server
Enter the SQL Server connection details.
Here are the details I used on the SQL Server installation tutorial:
- Server Name: localhost
- Authentication Type: SQL Login
- User name: sa
- Password: myPassw0rd
- Database Name: <default>
- Server Group: <default>
If you're connecting to a different machine, replace localhost with the name of that machine. Also replace the User name and Password with your own login details if they're different.
Most GUI tools use a similar process to connect. However, some tools might require you to go through a connection wizard and/or install a driver (like my connection with DBeaver). If you use a command line tool, you'll need to enter the connection details as a command (here's an example using sql-cli).
Create the Database
Now that we've connected to SQL Server, we can go ahead and create the database.
Open a New Query Tab
Click the New Query button to open a new query tab (unless one is already open).
Run the Script
Enter the following line and click Run:
That command creates a database called Music.
View the Database
Your new database should now appear under the Databases node in the left panel. If not, you might need to refresh the list before the database appears.
To refresh, right-click on Databases and select Refresh to refresh the list of databases.
A More Complete Database
That database we just created is an empty database. It has no tables, and it contains no data. That's not much fun.
Throughout the rest of this tutorial, we'll add some tables and data. We'll also run queries against the data.