Lab 01

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Lab Manual DBS 262L

Week 1. Introduction to Data Base and SQL Server CLO: 1

Introduction to Database
Database Management System or DBMS in short refers to the technology of storing and
retrieving user data with utmost efficiency along with appropriate security measures. This tutorial
explains the basics of DBMS such as its architecture, data models, data schemas, data
independence, E-R model, relation model, relational database design, and storage and file
structure and much more.
Why to Learn DBMS?
Traditionally, data was organized in file formats. DBMS was a new concept then, and all the
research was done to make it overcome the deficiencies in traditional style of data management.
A modern DBMS has the following characteristics −
• Real-world entity − A modern DBMS is more realistic and uses real-world entities to
design its architecture. It uses the behavior and attributes too. For example, a school
database may use students as an entity and their age as an attribute.
• Relation-based tables − DBMS allows entities and relations among them to form tables.
A user can understand the architecture of a database just by looking at the table names.
• Isolation of data and application − A database system is entirely different than its data.
A database is an active entity, whereas data is said to be passive, on which the database
works and organizes. DBMS also stores metadata, which is data about data, to ease its
own process.
• Less redundancy − DBMS follows the rules of normalization, which splits a relation
when any of its attributes is having redundancy in values. Normalization is a
mathematically rich and scientific process that reduces data redundancy.
• Consistency − Consistency is a state where every relation in a database remains consistent.
There exist methods and techniques, which can detect attempt of leaving database in
inconsistent state. A DBMS can provide greater consistency as compared to earlier forms
of data storing applications like file-processing systems.
• Query Language − DBMS is equipped with query language, which makes it more
efficient to retrieve and manipulate data. A user can apply as many and as different
filtering options as required to retrieve a set of data. Traditionally it was not possible where
file-processing system was used.
Applications of DBMS
Database is a collection of related data and data is a collection of facts and figures that can be
processed to produce information.
Mostly data represents recordable facts. Data aids in producing information, which is based on
facts. For example, if we have data about marks obtained by all students, we can then conclude
about toppers and average marks.
A database management system stores data in such a way that it becomes easier to retrieve,
manipulate, and produce information. Following are the important characteristics and
applications of DBMS.
• ACID Properties − DBMS follows the concepts of Atomicity, Consistency, Isolation,
and Durability (normally shortened as ACID). These concepts are applied on transactions,
which manipulate data in a database. ACID properties help the database stay healthy in
multi-transactional environments and in case of failure.
• Multiuser and Concurrent Access − DBMS supports multi-user environment and allows
them to access and manipulate data in parallel. Though there are restrictions on
transactions when users attempt to handle the same data item, but users are always
unaware of them.
• Multiple views − DBMS offers multiple views for different users. A user who is in the
Sales department will have a different view of database than a person working in the
Production department. This feature enables the users to have a concentrate view of the
database according to their requirements.
• Security − Features like multiple views offer security to some extent where users are
unable to access data of other users and departments. DBMS offers methods to impose
constraints while entering data into the database and retrieving the same at a later stage.
DBMS offers many different levels of security features, which enables multiple users to
have different views with different features. For example, a user in the Sales department
cannot see the data that belongs to the Purchase department. Additionally, it can also be
managed how much data of the Sales department should be displayed to the user. Since a
DBMS is not saved on the disk as traditional file systems, it is very hard for miscreants to
break the code.
Users
A typical DBMS has users with different rights and permissions who use it for different purposes.
Some users retrieve data and some back it up. The users of a DBMS can be broadly categorized
as follows −

• Administrators − Administrators maintain the DBMS and are responsible for


administrating the database. They are responsible to look after its usage and by whom it
should be used. They create access profiles for users and apply limitations to maintain
isolation and force security. Administrators also look after DBMS resources like system
license, required tools, and other software and hardware related maintenance.
• Designers − Designers are the group of people who actually work on the designing part
of the database. They keep a close watch on what data should be kept and in what format.
They identify and design the whole set of entities, relations, constraints, and views.
• End Users − End users are those who actually reap the benefits of having a DBMS. End
users can range from simple viewers who pay attention to the logs or market rates to
sophisticated users such as business analysts.

DBMS DATA Model


Data models define how the logical structure of a database is modeled. Data Models are
fundamental entities to introduce abstraction in a DBMS. Data models define how data is
connected to each other and how they are processed and stored inside the system.
The very first data model could be flat data-models, where all the data used are to be kept in the
same plane. Earlier data models were not so scientific, hence they were prone to introduce lots of
duplication and update anomalies.
Entity-Relationship Model
Entity-Relationship (ER) Model is based on the notion of real-world entities and relationships
among them. While formulating real-world scenario into the database model, the ER Model
creates entity set, relationship set, general attributes and constraints.
ER Model is best used for the conceptual design of a database.
ER Model is based on −
• Entities and their attributes.
• Relationships among entities.
These concepts are explained below.

• Entity − An entity in an ER Model is a real-world entity having properties called


attributes. Every attribute is defined by its set of values called domain. For example, in
a school database, a student is considered as an entity. Student has various attributes like
name, age, class, etc.
• Relationship − The logical association among entities is called relationship.
Relationships are mapped with entities in various ways. Mapping cardinalities define the
number of associations between two entities.
Mapping cardinalities –

o one to one
o one to many
o many to one
o many to many
Relational Model
The most popular data model in DBMS is the Relational Model. It is more scientific a model than
others. This model is based on first-order predicate logic and defines a table as an n-ary relation.

The main highlights of this model are −

• Data is stored in tables called relations.


• Relations can be normalized.
• In normalized relations, values saved are atomic values.
• Each row in a relation contains a unique value.
• Each column in a relation contains values from a same domain.

Database Schema
A database schema is the skeleton structure that represents the logical view of the entire database.
It defines how the data is organized and how the relations among them are associated. It
formulates all the constraints that are to be applied on the data.
A database schema defines its entities and the relationship among them. It contains a descriptive
detail of the database, which can be depicted by means of schema diagrams. It’s the database
designers who design the schema to help programmers understand the database and make it
useful.
A database schema can be divided broadly into two categories −
• Physical Database Schema − This schema pertains to the actual storage of data and its
form of storage like files, indices, etc. It defines how the data will be stored in a secondary
storage.
• Logical Database Schema − This schema defines all the logical constraints that need to
be applied on the data stored. It defines tables, views, and integrity constraints.
Database Instance
It is important that we distinguish these two terms individually. Database schema is the skeleton
of database. It is designed when the database doesn't exist at all. Once the database is operational,
it is very difficult to make any changes to it. A database schema does not contain any data or
information.
A database instance is a state of operational database with data at any given time. It contains a
snapshot of the database. Database instances tend to change with time. A DBMS ensures that its
every instance (state) is in a valid state, by diligently following all the validations, constraints,
and conditions that the database designers have imposed.
Introduction to SQL Server CLO 1

SQL SERVER is a relational database management system (RDBMS) developed by Microsoft.


It is primarily designed and developed to compete with MySQL and Oracle database.

SQL Server supports ANSI SQL, which is the standard SQL (Structured Query Language)
language. However, SQL Server comes with its own implementation of the SQL language, T-
SQL (Transact-SQL).

T-SQL is a Microsoft propriety Language known as Transact-SQL. It provides further


capabilities of declaring variable, exception handling, stored procedure, etc.

SQL Server Management Studio (SSMS) is the main interface tool for SQL Server, and it
supports both 32-bit and 64-bit environments.

SQL Server Enterprise: It is used in the high end, large scale and mission Critical business. It
provides High-end security, Advanced Analytics, Machine Learning, etc.

SQL Server Standard: It is suitable for Mid-Tier Application and Data marts. It includes basic
reporting and analytics.

SQL Server WEB: It is designed for a low total-cost-of-ownership option for Web hosters. It
provides scalability, affordability, and manageability capabilities for small to large scale Web
properties.

SQL Server Developer: It is similar to an enterprise edition for the non-production


environment. It is mainly used for build, test, and demo.

SQL Server Express: It is for small scale applications and free to use.

Key Components and Services of SQL Server

Database Engine: This component handle storage, Rapid transaction Processing, and Securing
Data.

SQL Server: This service starts, stops, pauses, and continues an instance of Microsoft SQL
Server. Executable name is sqlservr.exe.

SQL Server Agent: It performs the role of Task Scheduler. It can be triggered by any event or
as per demand. Executable name is sqlagent.exe.

SQL Server Browser: This listens to the incoming request and connects to the desired SQL
server instance. Executable name is sqlbrowser.exe.
SQL Server Full-Text Search: This lets user running full-text queries against Character data in
SQL Tables. Executable name is fdlauncher.exe.

SQL Server VSS Writer: This allows backup and restoration of data files when the SQL server
is not running. Executable name is sqlwriter.exe.

SQL Server Analysis Services (SSAS): Provide Data analysis, Data mining and Machine
Learning capabilities. SQL server is integrated with R and Python language for advanced
analytics. Executable name is msmdsrv.exe.

SQL Server Reporting Services (SSRS): Provides reporting features and decision-making
capabilities. It includes integration with Hadoop. Executable name is
ReportingServicesService.exe

SQL Server Integration Services (SSIS): Provided Extract-Transform and Load capabilities of
the different type of data from one source to another. It can be view as converting raw information
into useful information. Executable name is MsDtsSrvr.exe

SQL Server Instances

SQL Server allows you to run multiple services at a go, with each service having separate logins,
ports, databases, etc. These are divided into two:

• Primary instances
• Named instances.

There are two ways through which we may access the primary instance. First, we can use the server
name. Secondly, we can use its IP address. Named instances are accessed by appending a backslash
and instance name.

For example, to connect to an instance named xyx on the local server, you should use
127.0.0.1\xyz. From SQL Server 2005 and above, you are allowed to run up to 50 instances
simultaneously on a server.

Note that even though you can have multiple instances on the same server, only one of them
must be the default instance while the rest must be named instances. One can run all the
instances concurrently, and each instance runs independent of the other instances.

Importance of SQL Server Instances

The following are the advantages of SQL Server instances:

1. For installation of different versions on one machine

You can have different versions of SQL Server on a single machine. Each installation works
independently from the other installations.
2. For cost reduction

Instances can help us reduce the costs of operating SQL Server, especially in purchasing the SQL
Server license. You can get different services from different instances, hence no need for
purchasing one license for all services.

3. For maintenance of development, production and test environments separately

This is the main benefit of having many SQL Server instances on a single machine. You can use
different instances for development, production and test purposes.

4. For reducing temporary database problems

When you have all services running on a single SQL Server instance, there are high chances of
having problems with the problems, especially problems that keep on recurring. When such
services are run on different instances, you can avoid having such problems.

5. For separating security privileges

When different services are running on different SQL Server instances, you can focus on securing
the instance running the most sensitive service.

6. For maintaining a standby server

A SQL Server instance can fail, leading to an outage of services. This explains the importance of
having a standby server to be brought in if the current server fails. This can easily be achieved
using SQL Server instances.

Summary:

• SQL Server is defined as a relational database management system (RDBMS) developed


by Microsoft
• T-SQL means Transact-SQL, a propriety Language by Microsoft
• Microsoft and Sybase released version 1.0 in 1989.
• Various Editions of SQL Server are Enterprise, Standard, Web, Developer, and Express
• Critical components of SQL Server are Database Engine, SQL Server, SQL Server
Agent, SQL Server Browser, SQL Server Full-Text Search, etc.
• You can run multiple instances of SQL Server the same on the same machine.
Installation of SQL Server
There are multiple editions of SQL Server 2014 (Enterprise Edition, Enterprise Core
Edition, Business Intelligence Edition, Standard Edition, Web
Edition, Express and Developer Edition). SQL Server 2014 has a free edition – Express and
while the server itself lacks some options that other editions have, SQL Server 2014
Management Studio is the same and can be used with each of these.

Obtaining the installation file

The entire SQL Server Express edition can be downloaded from https://www.microsoft.com/en-
pk/download/details.aspx?id=42299, however, for downloading only SQL Server 2014
Management Studio, clicking the Download button will present a list of all files the complete
installation is contained of, but you’ll need only one of these:

The bottom two files are MgmtStudio 32BIT\SQLManagementStudio_x86_ENU.exe and


MgmtStudio 64BIT\SQLManagementStudio_x64_ENU.exe and you should choose one of
these according to the operating system running on the machine (32 or 64 bit), on which SQL
Server Management Studio will be installed.
If you aren’t sure which operating system type is installed on your machine, you can check it by
right-clicking in My Computer>Properties. The current operating system will be specified under
System type.

After selecting the desired file, click on the Next button in the bottom-right corner and the
download will begin.

Installation

The downloaded file should be in .exe format with size of approximately 650 MB. Double-click
on it to run the installation:

1. The window for choosing the directory to which the extracted files will be saved is
shown. After choosing the directory click the Ok button and extraction will begin

2. When the extraction is completed, it’ll take a couple of seconds until the SQL Server
2014 setup processes the current operation. After that, the following window will open:

This is the primary installation screen, and the other SQL tools installation can be started
here as well. If not already selected – select the Installation tab in the top-left corner of
the SQL Server Installation Center.
For installing SQL Server Management Studio alone, select the New SQL Server stand-
alone installation or add features to an existing installation option (as in the screenshots
above).

Once the installation wizard starts the SQL Server Installation Center can be closed.

3. It’ll take a couple of seconds for the setup rules to be checked (pre-requisites on the
operating system). If all the requirements are meet, the SQL Server 2014 setup will start
with the License Terms tab as a first step:

To proceed with the installation, read the license terms and then check the I accept the
license terms checkbox. The CEIP (Customer Experience Improvement Program)
checkbox is optional, but if it’s checked, the program will be able to collect information
about the computer hardware and how the product is being used (without interrupting
users); the next releases of SQL Server are upgraded based on this information.

After checking the I accept the license terms, the Next button can be clicked to proceed.
4. The next step is the Global Rules. Setup Global Rules identify problems that might
occur when installing SQL Server 2014. Which rules are those in some extent depends
on which operating system you are installing to but usually include the following:
• Whether the logged-in user is a system administrator with appropriate privileges (a must
be)
• Whether there are any reboots pending from other installers
• Whether required .NET components are available
• Whether there is support for long pathnames where the installation media resides
• The consistency of any SQL Server Registry keys

If all the rules are passed, the Global Rules step will be processed and skipped
automatically. If some rules don’t pass, you must correct these in order for setup to be
able to continue:

5. Most of the known issues are elaborated with solutions and workarounds on the Microsoft forum

6. The next step of the setup is the Microsoft Update. It’s optional and whether you select
it or not, the installation will be able to proceed after clicking the Next button.
Once checked this option gives the opportunity to download the update and incorporate it
with the installation. This action will take some time, as those updates need to be
downloaded as well.

If you proceeded without checking for updates or it is checked, but there aren’t any updates
available, the Product Updates step will be skipped:

It’s recommended that the Microsoft update option is checked to ensure all patches are applied.

7. Install Setup Files and Install Rules steps are automatically processed. However, the
Install Rules is yet another step where the setup wizard is checking if certain software
requirements are met:
• Need for reboot in order for changes to apply.
• Whether there are some previous releases of SQL Server
• Validation of SQL Server registry keys
• Whether the computer is a domain controller
• Security settings
Every rule in the list has a status (whether it’s passed or failed); clicking those links
provides additional information if something went wrong.

One rule that will almost certainly throw a warning is Window Firewall. This issue
specifically can be solved by adding SQL Server and its features to Windows Firewall
exception list. Otherwise, SQL Server Management Studio is unable to connect to remote
servers.

If some of these don’t pass, they must be corrected in order that setup can be continued:

Additional information for solving certain issues with the Install Rules can be found on
Microsoft SQL Server forum.

8. In Feature Selection step the only options that needs to be checked in order to install
SQL Server Management Studio is Management tools – basic and sub.
item: Management tools – Complete, however, SQL Client Connectivity SDK will be
installed by default, whether you checked it or not.
Each feature has prerequisites which are shown in the Prerequisites for selected
features field located right of the Features field, and if some are missing, those will be
installed along with SQL Server Management Studio:

In addition, there is a short description for each feature in the Feature description field
for more details.

SQL Server Management Studio will be installed in default directory on system partition,
but below the Features field it can be altered in which directory you want these shared
components installed (as shown in image above)

9. After you proceeded on the Next button, Feature Rules and Feature Configuration
Rules steps will be processed automatically if all the Feature Rules are met:
• Prior Visual Studio 2010 instances requiring update.
• Microsoft .NET Framework 3.5 Service Pack 1 is required.

You must repair failures for the installation to be able to proceed.

The update required for Visual Studio is contained on the SQL Server installation media
and it’s named VS10sp1-KB983509.msp.
The Microsoft .NET Framework 3.5 Service Pack 1 can be found on this link.

When all the rules are passed and the Feature Rules and the Feature
Configuration Rules steps are processed automatically, the installation
process will start in Installation Progress step.

10. The SQL Server Management Studio installation process should take no
more than approximately 4 minutes if there is no actual server installed on
the machine After the installation process is completed, the last step of the
installation wizard will be presented:

In this way SQL server management studio has been installed on your
computer and you can search in the task bar or in the start option.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy