KEMBAR78
Dbms File | PDF | Microsoft Sql Server | Data Type
0% found this document useful (0 votes)
6 views8 pages

Dbms File

Dbms file

Uploaded by

gillbrian2105
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)
6 views8 pages

Dbms File

Dbms file

Uploaded by

gillbrian2105
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/ 8

Practical - 1

Aim: Introduction to SQL and Installation of SQL Server / Oracle


Objective:

To understand the basics of SQL (Structured Query Language) and learn how to install SQL Server or Oracle
database management software.

Introduction:

SQL (Structured Query Language) is a standard language for managing and manipulating relational databases.
It is used to perform various operations like data retrieval, insertion, updating, and deletion in a database.

SQL Server and Oracle are two popular relational database management systems (RDBMS) widely used in
industry for data management. In this practical, we will focus on installing either SQL Server or Oracle
Database on a local machine.

Requirements:

● A computer with an internet connection.


● Administrative privileges on the computer to install new software.
● Enough disk space (at least 10 GB) for installation.

Steps to Install SQL Server:

1. Download SQL Server:


o Go to the official Microsoft SQL Server download page.
o Choose the version of SQL Server you wish to install (e.g., SQL Server 2019 Developer edition)
and click the download link.
2. Run the Installer:
Name: Brian Gill Roll no: 2336803 Section: B2 Subject: Database Management System
o Once downloaded, run the SQL Server installer. Choose the installation type as "Basic" or
"Custom" based on your preference.
o For the first time, it is recommended to choose the "Basic" installation to understand the
fundamental setup.
3. Installation Process:
o Accept the license terms and click "Next."
o Choose the installation path (default is recommended).
o Click "Install" and wait for the installation process to complete. This may take several minutes.
4. Set up SQL Server Management Studio (SSMS):
o Download SQL Server Management Studio from the official Microsoft website.
o Install SSMS following the same steps as the SQL Server installer.
o Open SSMS and connect to your local SQL Server instance using Windows Authentication.
5. Verify Installation:
o Open SSMS and connect to your local SQL Server instance.
o Right-click on "Databases" and select "New Database." Name your database and click "OK."
o Your SQL Server installation is now complete and ready to use.

Steps to Install Oracle Database:

1. Download Oracle Database:


o Go to the official Oracle Database download page.
o Select the version of Oracle Database you wish to install (e.g., Oracle Database 19c) and click
the download link.
2. Run the Installer:
o Unzip the downloaded Oracle Database software.
o Open the folder and run the setup.exe (Windows) or corresponding executable file
(Linux/Unix).

Name: Brian Gill Roll no: 2336803 Section: B2 Subject: Database Management System
o
3. Installation Process:
o Follow the on-screen instructions to install Oracle Database.
o Choose "Desktop Class" installation for a simple setup.
o Set the Oracle base and software location (default settings are usually recommended).
o Set the database name, password, and other configurations as prompted.
o Click "Install" to begin the installation process. This can take some time depending on your
system.
4. Set up Oracle SQL Developer:
o Download and install Oracle SQL Developer from the official website.
o Open SQL Developer and create a new connection to your Oracle Database instance using the
credentials provided during installation.
5. Verify Installation:
o Open Oracle SQL Developer and connect to your local Oracle Database instance.
o Create a new schema or use the default schema provided.
o Run basic SQL commands like SELECT * FROM DUAL; to verify the installation.

Conclusion:

In this practical, you have learned how to install SQL Server or Oracle Database and execute basic SQL
commands. This foundational knowledge is crucial for further practicals involving database management and
SQL operations.

Name: Brian Gill Roll no: 2336803 Section: B2 Subject: Database Management System
Practical - 2
Aim: To study Datatypes in SQL
Objective:
The objective of this study is to understand the different types of data types in SQL and learn where and how
they are used in database systems.

Theory:

What is a Data Type in SQL?


In SQL (Structured Query Language), a data type defines the kind of value a column can store in a table. It
specifies the type of data (like integer, string, date, etc.) and helps ensure data consistency, integrity, and
efficient memory allocation.
When creating a table, each column must be assigned a data type so that the database knows how to store and
handle the data in that column.

Types of Data Types in SQL


SQL data types are broadly categorized into the following groups:
1. Numeric Data Types
2. Character/String Data Types
3. Date and Time Data Types
4. Binary Data Types
5. Miscellaneous/Other Data Types

1. Numeric Data Types


Used to store numbers (with or without decimal values).
Data Type Description
INT / INTEGER Stores whole numbers. E.g., 1, 50, -20
SMALLINT Stores smaller range of integers. Saves memory.
BIGINT Stores very large integers.
DECIMAL(p,s) / Stores fixed-point numbers with precision (p) and scale (s). Ideal for financial
NUMERIC(p,s) calculations.
Stores approximate floating-point numbers (decimals). Less precise but useful
FLOAT / REAL
in scientific calculations.

2. Character/String Data Types


Used to store text or strings.
Data Type Description
CHAR(n) Fixed-length string. Pads with spaces if input is shorter.
VARCHAR(n) Variable-length string. Efficient for different lengths of text.
TEXT Stores long text data (e.g., paragraphs).

3. Date and Time Data Types


Name: Brian Gill Roll no: 2336803 Section: B2 Subject: Database Management System
Used to store date and/or time values.
Data Type Description
DATE Stores date only (YYYY-MM-DD).
TIME Stores time only (HH:MM:SS).
DATETIME Stores both date and time.
TIMESTAMP Stores a unique timestamp. Often used for tracking changes.

4. Binary Data Types


Used to store binary data such as images, audio files, or other multimedia.
Data Type Description
BINARY(n) Fixed-length binary data.
VARBINARY(n) Variable-length binary data.
BLOB (Binary Large Object) Stores large binary objects like images or files.

5. Miscellaneous / Other Data Types


Used for special use cases.
Data Type Description
BOOLEAN Stores TRUE or FALSE values (often 1 or 0).
ENUM Stores one value from a list of predefined values.
SET Stores zero or more values from a predefined list.

Command to create table:

Table description with datatype:

Practical - 3

Name: Brian Gill Roll no: 2336803 Section: B2 Subject: Database Management System
Aim: To Create, Alter and Drop table in SQL.
Objective:
To understand and perform basic table operations such as creation, modification, and deletion using SQL.

Theory:
In SQL, tables are used to store structured data. SQL provides Data Definition Language (DDL)
commands such as CREATE, ALTER, and DROP to define and manage table structures.

1. CREATE TABLE
The CREATE TABLE command is used to define a new table along with its columns and data
types.
Syntax:
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
...
);
Command:

Output:

2. ALTER TABLE
The ALTER TABLE command is used to modify the structure of an existing table. It can be
used to add, delete, or modify columns.
 Add a new column:
Syntax:
ALTER TABLE table_name
ADD column_name datatype;

Command:

Name: Brian Gill Roll no: 2336803 Section: B2 Subject: Database Management System
Output:

 Drop (delete) a column:


Syntax:
ALTER TABLE table_name
DROP COLUMN column_name;
Command:

Output:

 Modify column name :


Syntax:
ALTER TABLE table_name
RENAME COLUMN old_column_name TO new_column_name;

Command:

Name: Brian Gill Roll no: 2336803 Section: B2 Subject: Database Management System
Output:

 Change column data type or size:


Syntax:
ALTER TABLE table_name
MODIFY column_name new_datatype(new_size);
Command:

Output:

3. DROP TABLE
The DROP TABLE command is used to permanently delete a table and all its data from the
database.
Syntax:
DROP TABLE table_name;

Command and Output:

Name: Brian Gill Roll no: 2336803 Section: B2 Subject: Database Management System

You might also like