Assignment 1 Introduction To SQL
Assignment 1 Introduction To SQL
STEP 1: After checking the version of the Windows OS (preferably WIN10 & WIN11), open the
browser and type “SQL Server Download” in the search engine.
URL: https://www.microsoft.com/en-in/sql-server/sql-server-downloads
STEP 2: After clicking on the above link, below screen will appear. Scroll down the same to find the
downloadable file as per the following screenshot
Download the .exe file by clicking on the download tab for the developer version as it has the
environment for learning from scratch without paying for the license.
STEP 3: After running the SetUp file downloaded above, the system administrator will ask for
permission to install on the machine. Click on “Allow Permission”. Once the file get installed on the
system, open the installer file and below screen appear on the screen.
Here we will get 3 options to choose to install either of the version on the system. We will select
‘CUSTOM’ version so as to have the C-Drive path enabled in our system for various files upon which
we will work in the SQL.
STEP 4: Post selecting ‘Custom’ version of the file type to be installed, we will land on to below
screenpage. Here, we will refrain from making any changes to default Media Location file path and
keep as it is. Next click on install.
On this screen select the first option “New SQL Server Standalone installation or add the feature to
an existing installation”.
STEP 6: Next, we will be taken to SQL Server 2022 setup. Here Microsoft will be scanning the system
compatibility in the background and will display the result as per the screenshot.
Note: All the parameters should be passed mandatorily, except the Window Firewall result as
“Warning”, which is acceptable. No parameter should be resulted as “Failed”
Click on the “Next” tab visible on the bottom right side of the screen.
STEP 7: Click “Next” option for the upcoming pages Installation Type, Edition, and License (after
accepting the terms & conditions) until Azure Extension for SQL Server page pops-up.
On this page, we need to un-check the “Azure Extension for SQL Server” as highlighted by the cursor,
as the same is not required as of now, since we are not working on the Azure cloud.
STEP 8: Now on the “Feature Selection” page, we will have to choose instance features or the
services from the SQL Server as required. As highlighted in the blue color in the below screenshot,
we will be selecting the services to adopt into our SQL Server.
Note: The Startup Type for various services as listed should be as shown.
Click on the “Add Current User” tab present on the bottom center of the screen. Wait until it displays
the desktop user name.
Click on the “Install’ tab present on the bottom right of the screen.
STEP 13: Following the completion of SQL Server Installation, we will land on the “Complete” page.
Note: Installation of all feature should be marked as “Succeeded” under the Status.
STEP 14: After successfully installing SQL Server, its time to install SQL Server Management Studio.
SSMS used to interact with the Database containing the data using the SQL language.
In the search engine bar, enter SSMS download and click in the first link from Microsoft as
highlighted shown in the screenshot. URL: https://learn.microsoft.com/en-us/sql/ssms/download-
sql-server-management-studio-ssms?view=sql-server-ver16
STEP 15: By clicking the URL, the below Microsoft page will open.
Scroll down to locate “Download SSMS”, and click on the link mentioned just below the header as
shown.
STEP 16: Once the setup file for SSMS gets downloaded, click on the file and initiate installation
procedure by clicking on “Install” Tab as highlighted in the below screenshot.
STEP 17: Upon the completion of the installation process for SSMS, below screen should appear on
the screen. Click on “Close” tab to close the installation wizard.
STEP 18: Locate the SSMS file in your system and double click on it to run the application.
STEP 19: The below page will open. Select Database Engine in the “Server Type” field.
By default the Server Name or the Instance Name should appear which was chosen while installation
if SQL Server.
If it doesn’t appear click on the drop down option to list down names. If the name still does not
appear, click on “browse for more” as shown in the following figure.
After clicking on “Browse for more” option, below dialogue box will pop-up, which will contain the
name of the instance used while installation of SQL Server. Select the same to return on the main
Connect to Server box.
QUESTION 2:
The Char and Varchar datatype are the subcategories of String datatype. String mean the data value
that comprises of characters such as alphabets, numerics and special signs such as “-, /, @ etc”
However below are the difference between Char and Varchar datatypes:
CHAR VARCHAR
This datatype is used to store the strings This datatype is used to store the strings type
which is of relatively small in length. data which is relatively longer in length.
This datatype is often specified with length This datatype is also specified length as
as shown in the example below shown in the example below
This datatype can stores the string data as This datatype can store the string data as
specified while declaring, and if the data is specified while declaring, and if the data is
shorter than the declared characters, it will shorter than the declared characters, it will
allocate blank spaces for the remaining not NOT allocate blank spaces for the remaining
utilized space. not utilized space.
Performance wise, this is relatively slower as Performance wise, this is relatively faster as
the time taken to process the output of such the time taken to process the output of such
datatype will be more in comparision to datatype will be less in comparision to Char
Varchar datatype. This is because the datatype, because of the no blank spaces
compiler will check each and every character which is present in the Char datatype.
for the corresponding space in the specified
length as declared.
If the string to be stored using this datatype
If the string to be stored in this datatype is is more than the total length as declared, it
more than that of the total length as decalred, gives error in the output while executing it
it stores the data upto the declared length and and do not save any such data.
the remaining extra characters from the
string data to be stored, gets truncated.
Ex: VARCHAR(25)
Ex: CHAR(7)
QUESTION 3
Nchar - Nchar datatype stores string datatype with unicode. It takes up two bytes to store the data
and can store upto 4000 chars. Unicode data refers to a universal coding standard for letters and
other data.
NVarchar - The NVARCHAR data type stores character data in a variable-length field. Data can be a
string of single-byte or multibyte letters, digits, and other characters that are supported by the code
set of corresponding database locale.
QUESTION 4:
The SQL commands are set of instruction that are used to interact with the data present in the table
in order to obtain the relative information regarding analysis task.
SQL
COMMANDS
Data Defination Language: Such commands deals with descriptions of the database schema and is
used to create and modify the structure of database objects in the database. DDL is a set of SQL
commands used to create, modify, and delete database structures but not data
Data Query Language: This command is used to obtain the schema from the database that has
relational and logical connection.
Data Manipulation Language: These commands is used to make any changes in the data present in
the table.
Transaction Control Language: Such command enables to execute the group of task to be
performed. It has only two outcomes - Success or Failure.
When all the task present in the group are performed it is called as success, and if either of the task
fails to get performed, it is called Failure.