0% found this document useful (0 votes)
16 views11 pages

Data Engg 03

The document provides an overview of SQL and RDBMS, explaining their definitions, advantages, and types of databases. It covers the installation of SQL Server Management Studio (SSMS), types of databases, SQL syntax for creating and managing databases, and various SQL data types. Additionally, it includes examples of how to declare and manipulate variables in SQL.

Uploaded by

Dhiraj Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views11 pages

Data Engg 03

The document provides an overview of SQL and RDBMS, explaining their definitions, advantages, and types of databases. It covers the installation of SQL Server Management Studio (SSMS), types of databases, SQL syntax for creating and managing databases, and various SQL data types. Additionally, it includes examples of how to declare and manipulate variables in SQL.

Uploaded by

Dhiraj Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Session -01

SQL - Structured Query Language

Data

Collection of meaningful information

Database

It is collection of data in file format.

For ex: excel, word, text, note pad etc.

Computer – Word , note pad , Excel for storing data

Disadvantage:

1. It stores less amount of data.


2. Data accessibility is very slow
3. No relationship between two or more files

RDBMS – Relational Database Management System – (Data Base)

1. It is collection of table related information or structured data information.


2. It stores huge amount of data and to extract data we have simple language called SQL
(Structured query language)
3. There is relation between two or more tables.

Table

It is collection of rows and columns.

Different flavors of RDBMS

1. SQL server Management Studio – SSMS – Microsoft


2. SQL developer – Oracle
3. Toad – Oracle
4. Teradata – Teradata
5. DB2 – IBM
6. Postgrey SQL
7. MySQL etc.

How to install SSMS

URL : https://www.microsoft.com/en-in/download/details.aspx?id=42299

You tube Video link: https://youtu.be/VKWIiJUl70A (Windows 11) /


https://youtu.be/QsXWszvjMBM (Windows 10) / you can search any video in you tube with below
keywords use :

How to download and install Microsoft SQL server 2008/2012/2014/2018/2019 for windows7/
windows10/ windows11

Computer Configuration : RAM - 4GB/ 8GB Har disk :256SSD/ 256GB/ 512GB ,
OS - WINDOWS 10 /11

SSMS Version: SQL Server 2014/2018/2019

OS : Windows 2007/08-

SQL server 2008/2012

For MacBook refer the below link

https://youtu.be/3BFxALltQaM

There are two types of databases (DB)

1. System Defined databases / System Database


2. User defined databases / Database Snapshots

1.System Defined databases

 Master - By default DB of Any RDBMS or SQL server


 Model
 Msdb
 Tempdb

SQL is not case sensitive language.

Ex: Meaning of CDS is as same as cds

Colors

Blue – System defined keywords

For ex: SELECT, CREATE , TABLE etc.

Pink – System defined functions

For ex: max, min, sum avg etc.

Green – User written Comments

2.User Defined database

In this user can create database by using a simple syntax i.e., CREATE DATABASE Name

How to create database?

Syntax: create database User_Defined_Database_Name

Every SQL statement ends with semicolon (;)

How to execute SQL statements?

1. Select SQL statement and click on Execute button on top of SQL server window.
2. Select SQL statement and press F5 key from keyboard

How to navigate user created DB or SQLCLASS?

Syntax: USE User_Defined_Database_Name or SQLCLASS


There are two types of comments in SQL

1. Single line comments (--)


2. Multiple line comments (/* multiple line statement */)
We want to create a simple employee table which hold complete employee details
of an organization.

EMP_ID, EMP_NAME, EMP_CITY, EMP_SAL,EMP_DOJ etc.

SQL DATA TYPES


Type of data / Value of an object can hold is known as data type

Different types of data type supported by SQL


1.Numeric Data type
2.String or character data type
3.Approximate Numeric data type
4.Data and time data type

1.Numeric Data type


This kind of data types supports only numeric values which is in
range from 0-9.

1.TINYINT
It will store value ranging from 0 to 255.

How data will store at the back-end memory


128 64 32 16 8 4 2 1

Suppose we want to store number 129 then it will store in below format
128 64 32 16 8 4 2 1 = 255
1 0 0 0 0 0 0 1

How to Declare Variable called number in SQL?


Syntax:
Declare @Variable_Name <Data Type>

How to assign value to a variable?


syntax:
SET @Variable_Name = Value

How to display variable value?


syntax:
Print @Variable_Name

Example:
1.

2.

Declare @num tinyint


SET @num = 256
print @num
Error: Arithmetic overflow error for data type tinyint, value = 256.

Session -02

2.SMALLINT
It stores value ranging from -32768 to 32767.

1.
Declare @val smallint
SET @val = 256
print @val

O/P - 256
2.

3.

4.

3.INT or INTEGER
It stores an integer value i.e., ranging from -2147483648 to
2147483647.
1.

2.

3.

4.BIGINT
It stores an integer value beyond the range of integer data type,
it stores 8 bytes of data.

1.

2.
3.

5.Decimal
It will display exact fixed-point number
We can use Precision as well as scale along with Decimal

Syntax: Decimal(Precision, Scale)

Precision: total number of digits, both to the the left and right of
the decimal point.
Scale : the number of digits to the right side of the decimal point.
1.

2.

3.
2.String or character data types
If we want to store string or character data in RDBMS then it should
always be enclosed within single quotes ('').

1.char
It will allow to store values like A-Z, a-z, 0-9, special
characters.
Static Memory allocation and its maximum size is 8000 characters.

For example:
if we want to store values like mobile number with country code or
email id then it contains alphanumeric value combination then we can
use string or character data types in SQL.

Functions

len() - This function is used to calculate length of string


datalength() - This function is used to calculate data type size.

1.

2.
3.

4.

5.
6.

2.varchar
It will allow to store values like A-Z, a-z, 0-9, special
characters.
Dynamic Memory allocation and its maximum size is 8000
characters.

1.

2.
3.

4.

5.
Session-03

3.Approximate Numeric Data Type

You might also like