0% found this document useful (0 votes)
17 views

First Lecture - Installation

Uploaded by

irfan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

First Lecture - Installation

Uploaded by

irfan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

SQL Server express edition:-

1. SQL Server Developer edition lets developers build any kind of application on top
of SQL Server.
2. It includes all the functionality of Enterprise edition, but is licensed for use as a
development and test system, not as a production server.
3. SQL Server Developer is an ideal choice for people who build and test applications.
SQL Server developer edition:-

1. Express edition is the entry-level, free database.


2. It is ideal for learning and building desktop and small server data-driven
applications.
3. It is the best choice for independent software vendors, developers, and hobbyists
building client applications.
4. If you need more advanced database features, SQL Server Express can be
seamlessly upgraded to other higher end versions of SQL Server.

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.

The SQL Server is a leading Relational Database Management System by


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

Microsoft provides two specialized free editions to work on MS SQL server:

1. Developer – It has all feature which MS SQL server offers but we


cannot use it in production. From the learning perspective, is it an ideal
candidate to start.
2. Express: This is also a free version but with the limited set of features
with no business intelligence applications.

Difference between DBMS and RDBMS


Although DBMS and RDBMS both are used to store information in physical database but
there are some remarkable differences between them.
The main differences between DBMS and RDBMS are given below:

No. DBMS RDBMS

1) DBMS applications store data RDBMS applications store data in a


as file. tabular form.

2) In DBMS, data is generally In RDBMS, the tables have an identifier


stored in either a hierarchical called primary key and the data values
form or a navigational form. are stored in the form of tables.

3) Normalization is not present Normalization is present in RDBMS.


in DBMS.

4) DBMS does not apply any RDBMS defines the integrity


security with regards to data constraint for the purpose of ACID
manipulation. (Atomocity, Consistency, Isolation and
Durability) property.

5) DBMS uses file system to store in RDBMS, data values are stored in the
data, so there will be no form of tables, so
relation between the tables. a relationship between these data
values will be stored in the form of a table
as well.

6) DBMS has to provide some RDBMS system supports a tabular


uniform methods to access the structure of the data and a relationship
stored information. between them to access the stored
information.

7) DBMS does not support RDBMS supports distributed database.


distributed database.

8) DBMS is meant to be for small RDBMS is designed to handle large


organization and deal with amount of data. it supports multiple
small data. it supports single users.
user.

9) Examples of DBMS are file Example of RDBMS


systems, xml etc. are mysql, postgre, sql
server, oracle 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 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.

Choose the basic version by clicking on the 'Basic' option, as it has all
default configuration required to learn MS SQL.

1. Instance name: This is by default labeled as MSSQLSERVER.


2. Connect now: This will open a separate command line window for
connection testing of what we have just installed.

The system will run by default 'select @@Version' statement to confirm


that we can connect to new MSSQLSERVER instance successfully.
3. Install SSMS: This is IDE which will take us to Microsoft SSMS
download link. We will cover SSMS in detail in our SSMS tutorial.

integrated development environment


4. An integrated development environment (IDE) is software for building
applications that combines common developer tools into a single graphical user
interface (GUI).

MS SQL Server is a client-server architecture. MS SQL Server process starts


with the client application sending a request. The SQL Server accepts,
processes and replies to the request with processed data.

SQL Server Management Studio (SSMS) is an IDE that provides a graphical


interface for connecting and working with MS SQL server. It was launched
with Microsoft SQL Server 2005 and is used for configuring, managing, and
administering all components within Microsoft SQL Server.

Let's understand each of the above fields

1. Server type: This is an option to select one out of four available MS


SQL services option. We will be working on 'Database Engine' for
creating and working with Database. Other Server type includes
Analysis, Reporting & Integration Services.

2. Server name: This is Server's name where MS SQL Server is installed


and need to establish the connection with that server. Generally, we use
the server name as "Machine name\Instance." Here Instance is the
name given to SQL Server instance while SQL server installation.

3. Authentication: This is defaulted to "Windows Authentication" if we use


"Windows Authentication" during SQL Server Installation. Else, if we
select 'Mixed Mode (Windows Authentication & Windows
Authentication)' then Authentication will be defaulted to "SQL Server
Installation."
4. User name\Password: If Authentication is selected other than
"Windows Authentication" like "SQL server Installation" then these two
fields will be required.

For Connection to Local DB – In SQL Management Studio, "Server Name"


Option could be

"."

"localhost"

"127.0.0.1"

"Machine\Instance"

Notes from the desk of Configuration/installation:

 In SQL Management Studio - For Connection via TCP\IP, "Server


Name" Option has to be "Machine\Instance of the server."
 SQL server uses port 1433 in TCP/IP.
What is Data?
In simple words, data can be facts related to any object in consideration. For
example, your name, age, height, weight, etc. are some data related to you. A
picture, image, file, pdf, etc. can also be considered data.

What is Database?
A database is a systematic collection of data. They support electronic storage
and manipulation of data. Databases make data management easy.

Let us discuss a database example: An online telephone directory uses a


database to store data of people, phone numbers, and other contact details.
Your electricity service provider uses a database to manage billing, client-
related issues, handle fault data, etc.

Let us also consider Facebook. It needs to store, manipulate, and present


data related to members, their friends, member activities, messages,
advertisements, and a lot more. We can provide a countless number of
examples for the usage of databases.

Technically, Database store the data in a well-organized manner for easy


access and retrieval. In SQL Server, there are two types of databases:

1. System databases: The system databases are created automatically


for you when you install the SQL Server. They play a crucial role in the
server, especially in ensuring that database objects run correctly.
Examples of SQL Server system databases include: Master, MSDB,
Model, Tempdb, Resource
2. User Databases: The user databases are created by the database
users like you who have been granted access to create databases

What version of SQL Server do I have?

This unofficial build chart lists all of the known Service Packs (SP), Cumulative Updates (CU), patches,
hotfixes and other builds of MS SQL Server 2019, 2017, 2016, 2014, 2012, 2008 R2, 2008, 2005, 2000,
7.0, 6.5 and 6.0 that have been released.
Tried with microsoft sql server 2012 with windows 7.

Setting Suggested Description


Value(s)
Server type Database engine For Server type, select Database Engine (usually the default
option).
Server name The fully qualified For Server name, enter the name of your SQL Server (you can
server name also use localhost as the server name if you're connecting
locally). If you're NOT using the default instance
- MSSQLSERVER - you must enter in the server name and the
instance name.

If you're unsure how to determine your SQL Server instance


name, see Additional tips and tricks for using SSMS.
Authentication Windows Windows Authentication is set as default.
Authentication
You can also use SQL Server Authentication to connect.
SQL Server However, if you select SQL Server Authentication, a
Authentication username and password are required.

For more information about authentication types, see Connect


to the server (database engine).
Login Server account The user ID from the server account used to log in to the
Setting Suggested Description
Value(s)
user ID server. A login is required when using SQL Server
Authentication.
Password Server account The password from the server account used to log in the
password server. A password is required when using SQL Server
Authentication.

SQL Server SELECT


Summary: this tutorial introduces you to the basic of the SQL
Server SELECT statement, focusing on how to query against a single table.
Basic SQL Server SELECT statement
Database tables are objects that stores all the data in a database. In a table,
data is logically organized in a row-and-column format which is similar to a
spreadsheet.

In a table, each row represents a unique record and each column represents a
field in the record. For example, the customers table contains customer data
such as customer identification number, first name, last name, phone, email,
and address information as shown below:

SQL Server uses schemas to logically groups tables and other database objects. In our sample
database, we have two schemas: sales and production. The sales schema groups all the sales
related tables while the production schema groups all the production related tables.
To query data from a table, you use the SELECT statement. The following illustrates the most
basic form of the SELECT statement:
SELECT
select_list
FROM
schema_name.table_name;
Code language: SQL (Structured Query Language) (sql)
In this syntax:

 First, specify a list of comma-separated columns from which you want to query data
in the SELECT clause.
 Second, specify the source table and its schema name on the FROM clause.

When processing the SELECT statement, SQL Server processes the FROM clause first and then
the SELECT clause even though the SELECT clause appears first in the query.

SQL Server SELECT statement examples


Let’s use the customers table in the sample database for the demonstration.

A) SQL Server SELECT – retrieve some columns of a table example


The following query finds the first name and last name of all customers:

SELECT
first_name,
last_name
FROM
sales.customers;
Code language: SQL (Structured Query Language) (sql)
Here is the result:
The result of a query is called a result set.

The following statement returns the first names, last names, and emails of all customers:

SELECT
first_name,
last_name,
email
FROM
sales.customers;
Code language: SQL (Structured Query Language) (sql)

B) SQL Server SELECT – retrieve all columns from a table example


To get data from all columns of a table, you can specify all the columns in the select list. You
can also use SELECT * as a shorthand to save some typing:
SELECT
*
FROM
sales.customers;
Code language: SQL (Structured Query Language) (sql)
The SELECT * is useful for examining the columns and data of a table that you are not familiar
with. It is also helpful for ad-hoc queries.
However, you should not use the SELECT * for real production code due to the following main
reasons:

1. First, SELECT * often retrieves more data than your application needs to function. It causes
unnecessary data to transfer from the SQL Server to the client application, taking more time for data
to travel across the network and slowing down the application.
2. Second, if the table is added one or more new columns, theSELECT * just retrieves all columns that
include the newly added columns which were not intended for use in the application. This could
make the application crash.

C) SQL Server SELECT – sort the result set


To filter rows based on one or more conditions, you use a WHERE clause as shown in the
following example:
SELECT
*
FROM
sales.customers
WHERE
state = 'CA';
Code language: SQL (Structured Query Language) (sql)
In this example, the query returns the customers who locate in California.

When the WHERE clause is available, SQL Server processes the clauses of the query in the
following sequence: FROM, WHERE, and SELECT.

To sort the result set based on one or more columns, you use the ORDER BY clause as shown in
the following example:
SELECT
*
FROM
sales.customers
WHERE
state = 'CA'
ORDER BY
first_name;
Code language: SQL (Structured Query Language) (sql)

In this example, the ORDER BY clause sorts the customers by their first names in ascending order.
In this case, SQL Server processes the clauses of the query in the following
sequence: FROM, WHERE, SELECT, and ORDER BY.

D) SQL Server SELECT – group rows into groups example


To group rows into groups, you use the GROUP BY clause. For example, the following statement
returns all the cites of customers located in California and the number of customers in each city.
SELECT
city,
COUNT (*)
FROM
sales.customers
WHERE
state = 'CA'
GROUP BY
city
ORDER BY
city;
Code language: SQL (Structured Query Language) (sql)

In this case, SQL Server processes the clauses in the following sequence: FROM, WHERE, GROUP
BY, SELECT, and ORDER BY.

E) SQL Server SELECT – filter groups example


To filter groups based on one or more conditions, you use the HAVING clause. The following
example returns the city in California which has more than 10 customers:
SELECT
city,
COUNT (*)
FROM
sales.customers
WHERE
state = 'CA'
GROUP BY
city
HAVING
COUNT (*) > 10
ORDER BY
city;
Code language: SQL (Structured Query Language) (sql)

Notice that the WHERE clause filters rows while the HAVING clause filter groups.
In this tutorial, you have learned how to use the SQL Server SELECT statement to query data
from a single table.

You might also like