Dear readers of our blog, we'd like to recommend you to visit the main page of our website, where you can learn about our product SQLS*Plus and its advantages.
 
SQLS*Plus - best SQL Server command line reporting and automation tool! SQLS*Plus is several orders of magnitude better than SQL Server sqlcmd and osql command line tools.
 

REQUEST COMPLIMENTARY SQLS*PLUS LICENCE

Enteros UpBeat offers a patented database performance management SaaS platform. It proactively identifies root causes of complex revenue-impacting database performance issues across a growing number of RDBMS, NoSQL, and deep/machine learning database platforms. We support Oracle, SQL Server, IBM DB2, MongoDB, Casandra, MySQL, Amazon Aurora, and other database systems.

What are SQL Server and T-SQL

25 June 2020

SQL Server and T-SQL

SQL Server the most popular database management systems (DBMS) in the world. This DBMS is suitable for a variety of projects: from small applications to large highly loaded projects.

SQL Server was created by Microsoft. The first version was released in 1987. And the current version is version 16, which was released in 2016 and will be used in the current manual.

SQL Server has long been exclusively a database management system for Windows, but since version 16, this system is available on Linux.

SQL Server is characterized by such features as:

  • Performance. SQL Server works very fast.
  • Reliability and security. SQL Server provides data encryption.
  • Simplicity. It is relatively easy to work and administer with this DBMS.

The central aspect in MS SQL Server, as in any DBMS, is the database. A database is a storage of data organized in a certain way. Often physically the database represents a file on a hard disk though such conformity is not obligatory. For storage and administration of databases, database management system (DBMS) or DBMS is used. And just MS SQL Server is one of such DBMS.

MS SQL Server uses a relational model for database organization. This database model was developed back in 1970 by Edgar Codd. And to date, it is actually a standard for the organization of databases.

The relational model assumes data storage in the form of tables, each of which consists of rows and columns. Each row stores a separate object, and the columns contain the attributes of that object.

To identify each row within a table, the primary key is used. One or more columns can be used as a primary key. Using the primary key, we can refer to a certain row in the table. Accordingly, two rows cannot have the same primary key.

Through the keys, one table can be linked to another, i.e. links can be organized between two tables. And the table itself can be represented as a “relation”.

SQL (Structured Query Language) is used for interaction with the database

The client (for example, an external program) sends a query in SQL language through a special API. The DBMS properly interprets and executes the query and then sends the execution result to the client.

Originally SQL language has been developed in company IBM for system of databases which was called System/R. Thus language itself was called SEQUEL (Structured English Query Language). Although as a result neither the database nor the language itself were not subsequently officially published, traditionally the term SQL is often pronounced as a “sequel”.

In 1979, Relational Software Inc. developed the first database management system, called Oracle, which used the SQL language. Due to the success of this product, the company was renamed Oracle.

Subsequently, other database systems that used SQL began to appear. As a result, in 1989, the American National Standards Institute (ANSI) codified the language and published its first standard. Since then, the standard has been periodically updated and supplemented. The last update took place in 2011. But despite the presence of the standard, it is not uncommon for DBMS manufacturers to use their own SQL language implementations, which differ slightly from each other.

There are two types of SQL language: PL-SQL and T-SQL

PL-SQL is used in such DBMS as Oracle and MySQL. T-SQL (Transact-SQL) is used in SQL Server. That’s why in the current tutorial it will be considered T-SQL.

Depending on the task the T-SQL command executes, it can belong to one of the following types:

  1. DDL (Data Definition Language). This type includes various commands that create a database, tables, indexes, stored procedures, etc. In general, the data is defined.

In particular, we can refer to this type of commands as follows:

  • CREATE: creates database objects (the database itself, tables, indexes, etc.).
  • ALTER: changes the database objects
  • DROP: deletes database objects
  • TRUNCATE: deletes all data from tables

2. DML (Data Manipulation Language). This type includes commands to select data, update, add, delete them – in general, all those commands with which we can manage data.

This type includes the following commands:

  • SELECT: retrieves data from the database.
  • UPDATE: updates data
  • INSERT: adds new data
  • DELETE: deletes data

3. DCL (Data Control Language). This type refers to commands that control access rights to data. In particular, these are the following commands:

  • GRANT: grants rights to access the data
  • REVOKE: revokes data access rights

MS SQL Server 2017 Installation

MS SQL Server is available in various versions. First of all, it is MS SQL Server Enterprise – full release, aimed at using in real projects. It is used on various hosting and database servers. However, it is available only in the paid version (not counting the trial period) and costs quite decent money.

For simple applications may also suffice and release Express: it is free. Besides it has advantage – it can be put as a real server and used in real tasks, however it has the reduced functionality in comparison with the full version.

And also there is MS SQL Server Developer Edition. It is a full-featured release, which contains all functionality, as well as the full version of MS SQL Server Enterprise, only targeted only for development needs. At the same time, this version can not be used for deployment as a real server on real projects. However, to study all the mechanics of MS SQL Server, this version is the best option, so this version we will use.

So, let us install MS SQL Server 2017 Developer Edition. For this purpose we will go to my.visualstudio.com. You may need a Microsoft account to access it. In this case you need to login with a Microsoft account.

MS SQL Server 2017 Developer EditionWe leave English as the default language and download the entire iso file. Since the downloaded file has the extension .iso, then after the download we unpack it and run the installer program. We will see the installation wizard window:

the installation wizard window

Here we select the first item “New SQL Server stand-alone installation or add features to an existing installation“. Next, using a sequence of steps, we will need to set the installation options.

Let’s click to the item “Product Key”. At this stage, you need to enter the key, or specify one of the free issues. Here we specify the “Developer” release and proceed to the new step by clicking the Next button.

Let's click to the item "Product Key"

Next, the license agreement will have to be accepted. And then we snap to the “Feature Selection” step. At this stage you are offered to select the components to be installed. Here we mark all the components, taking into account the amount of free memory:

Feature Selection

Depending on the selected components, the number of installation steps increases, where any settings need to be made. In my case all components are selected. So in the future we will consider the case when all the components are selected.

Next, on the step “Instance Configuration” we will need to specify the name and ID of the running SQL Server entity.

Instance Configuration

For the name, specify the Default instance option, and for the ID, set MSSQLSERVER. This will be the name of the instance that we can use to reach the server from external applications.

Then click the next two steps with the default options to “Database Engine Configuration“. Using the Add Current User button here, we will add the current user as the server administrator.

Database Engine Configuration

On the next step of “Analysis Services Configuration” we will also add the current user as an administrator for the Analysis Services feature:

Analysis Services Configuration

The next two steps are to leave the default settings. And then on the step “Distributed Replay Controller” we will similarly add the current user.

Distributed Replay Controller

On all subsequent steps leave the default settings and on the last screen for installation click the Install button:

On all subsequent steps leave the default settings

After some time MS SQL Server will be installed.

So, we have installed SQL Server 2017 and assigned the identifier “MSSQLSERVER” to it. It should be noted that before connecting to it, you should make sure that it is running. To do this, you can open the service window. If it is not running, we can run it there in the service panel and then we can work with it.

Installing SQL Server Management Studio

For convenient database management and various options and settings in MS SQL Server we will install a special administration tool called SQL Server Management Studio (SSMS). You can use this tool to create databases and their tables, write and execute database queries and much more.

To install SSMS, go to docs.microsoft.com. Closer to the bottom of the page we will find links to versions for different locales. Download the English version (or you can choose the localized version in any other language if you want).

Despite the fact that this version of SSMS has the number 17, it also applies to MS SQL Server 2016 and even earlier versions of the server.

After downloading, let’s run the SSMS installation program:

Installing SQL Server Management Studio

To install, click on the Install button.

After installation we will find SQL Server Management Studio in the Start menu among installed programs in Microsoft SQL Server Tools 2017.

Okay, let’s run the SQL Server Management Studio. First, we will be asked to connect to the right server.

let's run the SQL Server Management Studio

In the “Server name” field, select “Browse for more…” from the drop-down list. And a window will open where you will need to select the desired server:

window will open where you will need to select the desired server

In my case, the local computer has two servers, the Express release and the Developer release. But by name I can understand that the first item represents Express and therefore I need to select the second item. If there is only one Express release installed on the local computer, then I don’t have to select that release.

After you select a server, its name will be displayed in the “Server name” field. And then you will need to click on the Connect button to connect to it:

its name will be displayed in the Server name field

And after successful connection the program will open the server content – all its databases and other components:

all its databases and other components

Introduction to Transact SQL (T-SQL) using Microsoft SQL Server

 
Tags: , , , , ,

MORE NEWS

 

Preamble​​NoSql is not a replacement for SQL databases but is a valid alternative for many situations where standard SQL is not the best approach for...

Preamble​​MongoDB Conditional operators specify a condition to which the value of the document field shall correspond.Comparison Query Operators $eq...

5 Database management trends impacting database administrationIn the realm of database management systems, moreover half (52%) of your competitors feel...

The data type is defined as the type of data that any column or variable can store in MS SQL Server. What is the data type? When you create any table or...

Preamble​​MS SQL Server is a client-server architecture. MS SQL Server process starts with the client application sending a query.SQL Server accepts,...

First the basics: what is the master/slave?One database server (“master”) responds and can do anything. A lot of other database servers store copies of all...

Preamble​​Atom Hopper (based on Apache Abdera) for those who may not know is an open-source project sponsored by Rackspace. Today we will figure out how to...

Preamble​​MongoDB recently introduced its new aggregation structure. This structure provides a simpler solution for calculating aggregated values rather...

FlexibilityOne of the most advertised features of MongoDB is its flexibility.  Flexibility, however, is a double-edged sword. More flexibility means more...

Preamble​​SQLShell is a cross-platform command-line tool for SQL, similar to psql for PostgreSQL or MySQL command-line tool for MySQL.Why use it?If you...

Preamble​​Writing an application on top of the framework on top of the driver on top of the database is a bit like a game on the phone: you say “insert...

Preamble​​Oracle Coherence is a distributed cache that is functionally comparable with Memcached. In addition to the basic function of the API cache, it...

Preamble​​IBM pureXML, a proprietary XML database built on a relational mechanism (designed for puns) that offers both relational ( SQL / XML ) and...

  What is PostgreSQL array? In PostgreSQL we can define a column as an array of valid data types. The data type can be built-in, custom or enumerated....

Preamble​​If you are a Linux sysadmin or developer, there comes a time when you need to manage an Oracle database that can work in your environment.In this...

Preamble​​Starting with Microsoft SQL Server 2008, by default, the group of local administrators is no longer added to SQL Server administrators during the...