Introduction to SQL Server
by Future Software in Living > Education
46 Views, 1 Favorites, 0 Comments
Introduction to SQL Server
In this tutorial, I will give an introduction to Microsoft SQL server. You will learn what it is, how to install it, and how to write some basic SQL code!
So get ready and follow along as I show you how to get started with Microsoft SQL Server!
What Is Microsoft SQL Server
Microsoft SQL Server is a set of programs that can store data. They use a system called SQL, which uses the SQL programming language to store different types of data in databases. there are two apps you use to create an SQL server. Microsoft SQL Server 2022, which creates the database engine, and SQL Server Management Studio, which allows you to manage the database engine. You can think of SQL servers kind of like glorified Excel spreadsheets. A good advantage of SQL servers as opposed to storing data in other services like Excel is that SQL servers can be connected to via the web, apps, and other services easily.
How to Set Up SQL Server
To set up SQL server, start by downloading the database engine at the following link: https://go.microsoft.com/fwlink/p/?linkid=2216019&clcid=0x409&culture=en-us&country=us. Open the downloaded file click "Install" and then select "Basic." next, download the management studio from this link: https://aka.ms/ssmsfullsetup, and use the downloaded file to install. Once both of the files are installed, open SQL Server Management studio, and in the box, check "Trust Server Certificate." Then you are into your SQL server.
How to Use SQL Server: Basics
To start using SQL server, you need to understand how it works. You can have 1 SQL Server per machine (real hardware or virtual.) In each SQL server, you can have multiple databases. these databases contain tables. The tables are like Excel spreadsheets. You can have columns and in the columns, you can have rows of data. To start, you will need to create a database. on the top bar, click "New Query" (You can use the above photos for help.) This will open up a text editor, and this is where you will write SQL code (or queries) to perform actions on your SQL server. To create a new database, type the following: CREATE DATABASE [Your database name]; So if my database was called "Test," I would type CREATE DATABASE Test; Now click execute at the top and wait a few seconds. Now reopen SQL Server Management Studio and you should see your database under the databases folder on the left. Expand your database and expand the "Tables" folder under it. To create a table, type:
CREATE TABLE [table name] (
[name of a colum] varchar(255),
[name of a colum] varchar(255),
[name of a colum] varchar(255)
);
You can replace [name of a column] with the name of that column, and you can add as many columns as you want. just make sure to put a "," after every varchar(255) except on the one at the very bottom. To insert data into a column, type:
INSERT INTO [table name] ([names of all the colums], [], [], ...)
VALUES ("value for that column", "", "", ...);
Also, at the top where it says "master", make sure to click down on that menu and select the database you want to perform the query on.
Thank you for reading and I hope you learned something!