Home Blog Page 3

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.

Create a table in SQL Server Management Studio (SSMS)


In this lesson, we will learn how to create a table in SQL Server Management Studio (SSMS).

Hello, and welcome to this introduction about SQL Server. I’ll be taking you through this course. So, what we’re going to do.First of all we’re going to find and download and instal a free version of SQL Server so you can play with it on your own computer.We’re going to open up a programme called SSMS, that’s Management Services and we’re going to create a database,create a table,insert some dataand retrieve that data.

We’re then going to look at the individual components of SQL Server. T-SQL, Database Administration, or DBA,SSIS, that’s SQL Server Integration Services,SSAS, that’s Analysis Services,and SSRS, that’s Reporting Services. And we’re going to have a look at some resources that can help you learn it.Books, videos and practise tests. We’ll also have a look at the official Microsoft website. So, let’s start.

Right, so the next thing we’re going to do,is we’re going to create a table.So a table stores data.So what sort of table am I going to create? Well, what I’m going to do, I’ve got some previously created data here,and this is a purchase system.So in my purchase number one,I bought four of product number one at a cost of $50.26, totaling $201.04. My purchase order two, then I bought three numbers;359, and three of 360’s and so forth.So it is a perfectly ordinary transaction table.So I’m going to create it.I’m going to leave it on screen,so we can have a look at it while we create the table.

So to create the table, I’m going to right and click on tables and go New >Table. Again, there’s an awful lot of details that we can look at, but we’re just going to look at very simplistic, very easy to create things. So click new table, and here it says,well what columns are you going to create? So I want a column called purchase order ID, and I want another one called order quantity. I want product ID,unit price,and line total.

create-a-table-SQL-Server create-table-SQL

Now there is another thing that we have to specify at the same time. What type of column is it? Or more accurately, what sort of data do you want to store in the column? Now you can see that we got various choices,including,dates,time,text, though in reality, the one that I use the most of the time is called varchar, A variable character. And then we got things like integer.

Integers are whole numbers like one, two, three,instead of 1 1/2.So this is when we really need to look at the data that we got and decide what sort of column we want. And hopefully you can see that the first three columns can all be integers. They’re all whole numbers.  So let’s change them to ints, I-N-T.Now these last two contain–well money, essentially.  And so what I’m going to do is, Int would not be good enough, because if I put $50.26 into an int column, then it will truncate it to $50.

So I would have a certain lack of accuracy. So instead, what I’m going to do, with all of these, is I’m going to put it into the money data type. Though many other different types I could use, but just for now we’re going to use Int for integers and Money for–floating point numbers.  So now I’ve created it, I’ll press– Well what do I do? Well, I can press the Save Table here, or I can close this window.

So let’s click Save, either way we’ll get this choose a name. So what name am I going to call this?I’m going to call this, Transactions.So click okay, and close this, and we’ll go back to our object explorer,and you can see that the Transactions table is, where, exactly?Now, one of the things about object explorer,is that it doesn’t automatically update after you have created a new object. The only exception for this is a database that you have created or attached.


So, if you’ve created a new object,be it a table, a view, a procedure, or anything else,and you want it to appear,they would need to click on the Refresh icon. So now we can see that we have our Transactions table. D-B-O, Databaseowner.Transactions.Every table with have something before this dot, and that is called a schema. But, in this case, it doesn’t really matter what the schema is. So, in the next video, we’re going to populate it, we’re going to add some data to this table, and then we’re going to retrieve it.