SQL Server is made by Microsoft the Express version is free. When you install SQL Server, you will get the SQL Server Configuration Manager, which you can use to start and stop the services. You can also install the SQL Server Management Studio, which you can use to handle databases. So the Management Studio is a graphical SQL Client for SQL Server.
You can use the Configuration Manager to start and stop services
The SQL Server -Service should be running every time you want to use your SQL Server. And if you want to connect to your SQL Server database with your applications, also the SQL Server Browser-Service should be running.
You can use Management Studio to handle your databases. When you start it you will see below window. You can connect(Authenticate) with your Windows User or with SQL Server User accounts.
Here is an example how to create a database (named netshop) and a user(named netuser) and how to give proviles to the netshop-database to the netuser.
Login in using user netuser and create tables to the database netshop.
CREATE TABLE Customers ( id_Customers INT NOT NULL IDENTITY, first_name varchar(50) DEFAULT NULL, last_name varchar(50) DEFAULT NULL, street_address varchar(255) DEFAULT NULL, postnumber char(5) DEFAULT NULL, PRIMARY KEY ( id_Customers ) ); CREATE TABLE Products ( id_Products INT NOT NULL IDENTITY, product_name varchar(50) DEFAULT NULL, manufacturer varchar(255) DEFAULT NULL, model varchar(255) DEFAULT NULL, PRIMARY KEY ( id_Products ) ) ; CREATE TABLE Orders ( id_Orders INT NOT NULL IDENTITY, id_Products INT NOT NULL DEFAULT '0', id_Customers INT NOT NULL DEFAULT '0', order_day date DEFAULT NULL, amount INT DEFAULT NULL, PRIMARY KEY ( id_Orders ), FOREIGN KEY (id_Customers) REFERENCES Customers, FOREIGN KEY (id_Products) REFERENCES Products ) ;
INSERT INTO Customers (first_name,last_name,street_address,postnumber) VALUES ('Jim','Smith','Kotkantie 1','90650'); INSERT INTO Customers (first_name,last_name,street_address,postnumber) VALUES ('Lisa','Simpson','Uusikatu 1','90100'); INSERT INTO Customers (first_name,last_name,street_address,postnumber) VALUES ('Ann','Jones','Uusikatu 4','90100'); INSERT INTO Customers (first_name,last_name,street_address,postnumber) VALUES ('Bruce','Wayne','Aleksanterinkatu 4','01250'); INSERT INTO Products (product_name,manufacturer,model) VALUES ('Laptop','Lenovo','Ideapad'); INSERT INTO Products (product_name,manufacturer,model) VALUES ('Laptop','Asus','U31XU'); INSERT INTO Products (product_name,manufacturer,model) VALUES ('Camera','Canon','G11'); INSERT INTO Products (product_name,manufacturer,model) VALUES ('Navigator','TomTom','GoLive'); INSERT INTO Orders VALUES (4,1,'2013-05-20',1); INSERT INTO Orders VALUES (2,2,'2013-05-18',1); INSERT INTO Orders VALUES (3,3,'2013-05-17',2); INSERT INTO Orders VALUES (1,4,'2013-05-16',1); INSERT INTO Orders VALUES (3,1,'2013-05-15',1); INSERT INTO Orders VALUES (4,2,'2013-05-14',3); INSERT INTO Orders VALUES (2,3,'2013-05-13',1); INSERT INTO Orders VALUES (2,4,'2013-05-12',1);
You can add the database to SQL Server from SQL-file or from bak-file.
Here is assumed that you have an sql-file(northwind.sql), which includes the code that is needed for creating the database.
Create database Northwind Give the command in cmd: sqlcmd -S .\SQLEXPRESS -d Northwind -i northwind.sql\northwind.sql
You can create and execute the Bak-file from Management Studio. The file should be located on directory, which something like:C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\Backup
You can add the database like this
You can create the file like this: