Home Blog Page 2

How to change column headings and perform mathematical operations in SELECT? Section5

How to change column headings and perform mathematical operations in SELECT?

In the previous article we’ve seen how we can be able to project or display all these columns from a table as well as how we can be able to display only the top end rolls from a table in this movie you will see how we can be able to change a column hitting inside a select statement and how we can be able to perform some mathematical operation using columns is a select state.

I will also give you some overview of what mathematical operations or functions looks like inside a select statement. In this example some experts predicted that a population of every country in the world will be increasing by a million people in the next five years. And you are asked to call it final. Population value. Thirty five years. In this case what you can do is you can use a select statement a name of a country and our population size plus one million from country.

If you execute the sequence statement without using a column heading you’ll get a name like Australia Afghanistan and other countries. But for the newly created you not have any money in order to give it a column heading for I knew would call quited Cole and you can do as an economy now if execute the sequence statement. It’s going to give me a name of a country as well as the projected population besides using some simple mathematical operation like this.

Once the calls are also has some pre-built functions like this for example. In this case we want to calculate the total area in a row of every lake in the world that we can execute this one. This is going to be our total area in an average area of every link in the world. SQL Server also follows a mathematical rule or Mars or Rockett older division multiplication by addition and subtraction.

Like for example in this case we have two plus three times for the result. Could it be two plus 3 which is 5 5 times 4 which is 20. But because of bored us sequel server won’t finish multiplication ahead of time then it’s going to be three times four. Which is 12 plus 2. It is 14. So if we execute this month then we’ll get 14. But if we want to change how this operation works and we want to add two and three fourths then multiply it by 4.

We can use a bracket since the bracket comes first. The important rule then this will be calculated ahead of time. Then the result will be multiplied by four. Two plus three will be five lifetimes or is going to be 22. Now if I execute this statement I’ll get twenty.

How/ Why comments in SQL? Section3


In a previous article we’ve seen how we can be able to create the data is using a sequence script as well as a Server Management Studio features. We’ve also created in set up our sample data. We’ve also seen how we can be able to leverage drag control functionality in SSME so that we can be able to expedite it.

RC called development process we’ve seen how we can be able to select the top 1000 from any table. In it means without having to write any query so that we can be able to see what’s the structure of that table. If we are not familiar with that database we’ve seen how we can be able to change data in this context in a multi data environment.

This will be rather is going to be a very short one. We’ll see why we need comments as well as how we can be able to write comments and comments are a text input which are normally ignored or that are not going to be interpreted by sequencer but comments will play a major role in providing additional information about Sikorsky that we are creating.

Especially in a big database project that involves multiple developers. Sokolski it’s usually you’ll have who the author of that script is. What’s the purpose of the story. And then if there is any additional comments. And when was this screwed you did. Who created it. And if there are going to be multiple revisions to that original script we’re going to be adding the date of the revision. Who is the person who revised it. Why was there a change from the initial version. We need to specify that we also need to specify a usage of the script itself.

How is it going to be executed is it going to be executed from some windows job or is services going to call it or an API is going to call all sorts of procedures all that has to be specified so that the next person who will pick up are called to continue to evolve that will have a warning for Mission y. The script was read in what the purpose of that script is and how it’s going to be used. There are two forms sort of comments in sequence.

One is a multi-line com which is a C style comment. This is a novel he meant I am ready if I continue Adim additional lines. All of them is going to be commented out and till I add my closing syntax which is astri’s plus slush the other form of commenting is using double dashes for a single line. This is all in common. If I can teach me to try ears you’re not going to be combing.

But if I want to comment this want I can always go ahead and comment each line. Or we have additional feature in management studio we can uncomment these single line comments at once or we can comment them like this or we can do it control key control you to uncomment all control key.

Control-C to comment multiple lines together at the same time. This is what comments looks like in the course of Azi in the next article.


What an SSMS environment looks like? Important Short cuts -Section2


After a successful installation of SQL Server you can operate by going to the taskbar and types SQL Server Management Studio Or you can simply type SSMS. It’s just a mess. You’ll see this I can click on it after SQL Server Management Studio opens you’ll be mate with the connection dialog box.

If you accidentally cancel that one, you can always click there and you get this connection box. To connect to the server that you’re working on Give it the server name or your machine name. Or the simplest way to get your current machine name is just typed localhost then press connect. After you connect to the server using a server name which is localhost or an alias for our server name right here you’ll see databases Right now we don’t have any database that is created.

You might see some system diseases like master,model, msdb, tempdb monster is basically where you server holds all the important information and like the logging model is basically it will hold some template data for SQL Server uses to create some objects and msdb has something to do with SQL Server Agent or to run a scheduled jobs. TempDB is where it’s holding a temporary data or temporary tables. Don’t change anything here don’t delete any one of them so it might crash the entire sequence so.

Next you’ll see a security folder here under it. You’ll see logging, server role, credential, audit and audit specification. You don’t need to change anything here. But for us, since we created the server which makes it more let’s create one secure user account Right-Click new logging logging name. You can say See call user.  So it’s going to be a sequel authentication mode. Give it a good password here and repeat the same password here.

And you can choose a default database. Right now since we don’t have any user data mean leave the default answer on and enforce or pass on security. This is just temporary. So don’t enforce anything here and check that out. OK.

That will create a new user name sequel user. So if you want to log into the server using data logging You can always disconnect by clicking this button and click on to reconnect to change the authentication for windows to see quiet indication the server name is the scene local localhost top you know your user name which is call underscore a user for logging.  It’s not the case the but for a password. You have to provide it with the correct case. You can click to remember it but if it’s machine that is used by multiple people don’t click. Remember click connect.

Now as you can see going up to localhost using our new account which is Seacole user you’ll see some server objects here. Here is where we do a backup endpoint a link server link server if you have multiple servers and if you want to use a data that is stored in a sequel server that resides on a different Windows machine you can create a link server across a network. Replication is where you create your disaster recovery and then high availability. For now this is not the D.V. cause Don’t worry about this one.

Poley this is basically a new addition to see where you can access data that resides on and non-sequel or something like Hadoop. Always want to have availability is something sequencer added in a recent versions where you can create a deep grooves so that you can increase the performance of food and as well as make sure there’s no loss of data.

Management is another one you can create some policies extended even so you can create some extended events to see what’s going on inside the server. If theories deadlocks or anything like that here’s where you get a sequence of looks. If there is any error on the server or data level I’m getting an error because the sequel user doesn’t  have a mission to see that one. You can go back to our windows account restrictive account and be able to see that in detail. And we have integration services catalog.


If you install the course of integration services or is this is where you deploy your hardware and we have sequencer agent job if you want to execute some sort of procedure. For example if you want to send some e-mail to your users you can run us through procedure in UK in bulk data e-mail you can automatically send to them or you hear integration jobs needs to be executed. Here’s where you will see conserver agent and you can execute this job based on some schedule or based on some interval at the top you’ll see you know that you know file Nien Open Save save or everything is there.

It is the scene and do copy paste all they are is there server or object Explorer if you want. Well for example if you lost your object Explorer you can always go to View and click on object Explorer is that you can recover this back or you can open other other objects like the toolbox. We have a debug here if you have some still of procedures that you need to step in as they are. And if you want to depart them thoroughly you’ll use this functionality here we have a toolbox here. This is where you change your options for example to create creating new Querrey here as you can see here there’s no line number if you want to line number so that you can be able to reverse that.

You can go to Tools Options text editor you can go to transact see if you click on line number and click ok. You’ll see line 1. So wait so it’s good to keep adding line numbers for you here. The window is if you have multiple windows you can switch from one to the other or you can split this working window. And hell is basically it’s an on line here.

That’s what the sequencer meaning is looks like. Here we have new window. If you want to write a new sequence so you can click on that one go in and type your queries or select will use your insert wherever see where you have to go here and you have all this say and open here and open you’ll do the same. And if you can do for example new we have control and you can compress control and an end or it’s going to create a new query window or you can do control all it’s going to open.

These once the MDX and in Italy these are basically used in the sequence of analysis services. We know it’s going to be working on that one. If you have a multi pull databases and if you want to switch between one to the right now the current data is that we are working on is a master.  If you want to switch to model you can change is you have a user get visas if you want to switch from one day to every city out there or you can use are reserved for use and that will switch the context of that.

That means that you’re working on if you want to execute the call.  Here is where you execute it executes a month. For example select 1. And if I do execute, click on execute you’ll see there is no column name If I rename it as col_name now you will see this one will be changing to Col_name instead of no column name here. Or the simplest thing is we can do F5.  You can have multiple sequence statement in one query window.


For example, I can do select one column name. I can do select to call name in a file execute. You will see column one and of a cone column name too and you want to exit only a specific sequel’s statement.  You can’t always select that one and execute it.Now you’ll see number two and you don’t see number 1. So if you want to execute only a specific part of your query you have to select that part in executive or press F5 that will execute it for you. Debug we discussed about it when we talk about the debug menu this is what the SQL Server environment looks like.

And we’ve also discuss what are some of the shortcuts that you can use to automate your SQL development process. I see in the next article.


Learn Microsoft SQL Server-Introduction-Section1


Learn sql server online free.How to learn sql server? In this section it will be discussing about the following topics: we’ll briefly discuss what a database is. Is how to install Microsoft SQL Server specifically the developer version what the SQL Server Management Studio or SSMS environment looks like. We’ll see how to use some of important shortcuts.

In a SSMS, how to create a data is using SSMS shortcuts functionality as well as writing SQL Also discuss how to create a sample database that is used in this course. Which came from a CIA or a Central Intelligence Agency. We will see how to use drag and drop functionality in SSMS, how to select a table without even writing a query, how to change it database context in a multi database environment. We’ll see how to create as well as why we need comments in SQL.

What is a database?

This article we’ll discuss what a database is. A database is an organized collection of data that is used for the purposes of modeling some type of organization or organization on process.What we can understand from this is as long as there is an organized collection of data that we use to model some sort of an organization or a company different entities in that organization and different relationships we can be able to assume there is a database.

And a software package that we can use to manage these organized set of data or database is called a DBMS means or database management system. Relational databases such as SQL Server, MySQL, PostgreSQL and Oracle they use SQL as a language in order to be able to create different objects such as tables, views and stored procedures as well as to extract some data insert data. In this course we’ll be using SQL Serve as a data management system and we’ll discuss different aspects of this SQL language in the coming sections and movies.


What is the difference between different Editions of SQL Server?

In the previous article we’ve discussed different editions of course so we also decided to use a developer edition as it’s free and it also comes with all features of Enterprise Edition. In this article we’ll see how to download and install a developer version of SQL Server.

To do this go to your favorite web browser and type SQL Server Developer Edition latest installer. Once you’re in this page go ahead and download a developer edition save or run it. We have three basic options for this dialog box. A basic, custom and downloaded media. Let’s go with customer since we don’t need everything you can’t accept the default location where your extract file will get expanded.


Click install. This is going to take some time. Once it’s finished downloading it will extract the files to install. go to “Installation” this will be installing a sequence of standalone version. And add feature next. The installer will check if there is any installation rules are violated, you might see some warning like. The firewall is not disabled. It’s normal ok, so you can ignore these warning message click next.

We will be installing a new SQL Server and go ahead and select perform news SQL Server 2017 installation and click next. It is going to ask you to add a product key. A developer edition is free.  Just simply select a free developer edition. Click next. You have to accept the license terms. Next, it’s going to ask you to select features to installed. Simply select a database engine and click next. You will have an option to pick a default instance which is Or you can give it your name. It is common to use a default instance in the next dialog.

It’s going to ask you to do a server configuration in a normal production environment. You’re going to have to create a series accounting and use those services accounts you but for us. You can accept the default values and click next.  You can pick your authentication mode. You can leave it to a default. Windows authentication select select a mixed mode authentication.

Which is nothing but SQL Server authentication plus a Windows authentication for us to see how how the SQL authentication works let us select that one and give it a strong password that you will not forget. Specify a SQL Server administrator in a normal production environment. You’ll specify a services account here but for us add your account by clicking this button so that you will have a full admin privilege in that SQL Server that you are installing.

Next, you’ll see a summary of the configuration you made previously. If you see everything is good. Click to install. This is going to take some time. We’ll come back once this is done. After completing a sequence of developer edition installation the next thing to do is Tinas still see SQL Server Management Studio which is an IDE to write any SQL statement. As well as we can be able to use the GUI. Open your favorite browser and type SQL Server Management Studio installer Go to the first Microsoft Web site.

Then if you scroll down, you will see a tool section. Download SQL Server Management Studio SSMS. Click on that, wait for the installer to finish downloading install finished downloading click run then click install, follow the on screen dialog box and finish installing sql server management studio and I’ll be back once this is done.