0% found this document useful (0 votes)
37 views14 pages

Lab Report 402 Lab6 1

Uploaded by

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

Lab Report 402 Lab6 1

Uploaded by

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

R EPORT N O .

06

R EPORT ’ S T ITLE : DATABASE AND N OTEPAD


C OURSE C ODE : CSE-256
C OURSE T ITLE : DATABASE S YSTEMS L ABORATORY

Submitted by
Zakia Binta Syeed
Class Roll: 402

Submitted to
Dr. Md. Golam Moazzam
Professor
Md. Masum Bhuiyan
Lecturer

Computer Science and Engineering


Jahangirnagar University
Dhaka, Bangladesh

19th December,2024
Contents

List of Figures iii

List of Tables iii

List of Algorithms iii

Abstract iv

1 Abstract iv

2 OBJECTIVE 1

3 EQUIPMENT USED 2

4 PROCEDURE 3
4.1 Farhan.sql . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.2 Database before we Run the Notepad file we have Made . . . . . . . . . . . . . 7

5 OBSERVATIONS AND DISCUSSIONS 8


5.1 Observations: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

6 CONCLUSIONS 10

ii
List of Figures

4.1 List of Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7


4.2 After running the file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3 Enter Caption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

List of Tables

List of Algorithms

iii
Abstract

1. Abstract

[Importance of Relationship of Databases and Notepad]

Databases are commonly managed using specialized tools like SQL Management Studio or
graphical interfaces (GUIs). However, lightweight text editors such as Notepad can also serve
an important purpose in creating, editing, and managing database files, particularly for plain-
text formats like CSV, JSON, XML, or SQL scripts. This approach prioritizes simplicity, com-
patibility across platforms, and minimal system requirements.

This document examines the key aspects of using Notepad for database management, including:

1. Creating Database Scripts: Writing and modifying SQL commands to define database
structures, perform data operations, and execute queries.

2. Editing Plain-Text Formats: Adjusting files such as CSV, JSON, or XML used for
databases or data transfer.

3. Debugging Data Files: Identifying and correcting issues within database-related files.

4. Version Control: Tracking and managing changes to database scripts and configurations
using version control systems alongside Notepad.

While Notepad lacks advanced features like syntax highlighting or error detection, it can be
paired with plugins or complementary tools to enhance functionality. This abstract explores the
practicality and constraints of this straightforward approach for small-scale or urgent database
tasks.

iv
2. OBJECTIVE

The primary objective of using an SQL file in Notepad to control a database is to provide a
simple, lightweight, and platform-independent way to create, manage, and execute database
operations. Here are the detailed objectives:

1. Ease of Script Creation and Editing:


Purpose:
Notepad allows users to write and edit SQL commands in plain text without requiring
specialized software.
Benefits:
No setup or installation required for basic text editing. Accessible across different oper-
ating systems. Useful for quick edits or script development.
Portability
Purpose: SQL files are plain-text documents, making them portable and easily shareable.
Benefits
Compatible with various database management systems (e.g., MySQL, PostgreSQL, Or-
acle). Can be shared with team members. Can be version-controlled or archived for
future use.

2. Database Automation Purpose: SQL files can store complex scripts to automate database
tasks.
Benefits:
Repeatable tasks like schema creation, data insertion, and updates can be scripted and
reused. Reduces manual errors when executing repetitive commands.

3. Debugging and Learning Purpose: Writing SQL in Notepad allows users to focus on
the syntax and structure without distractions from graphical tools.
Benefits:

• Enhances understanding of SQL commands.


• Simplifies debugging by isolating SQL code from the database environment.

1
4. Integration with Database Systems Purpose: SQL files written in Notepad can be
executed directly in database systems or through command-line tools.
Benefits:
Allows batch processing of SQL commands by running entire scripts at once. Can be
integrated into deployment pipelines or scheduled for periodic execution.

5. Version Control and Documentation Purpose: SQL files saved in Notepad can be
tracked using version control systems like Git.
Benefits:
Enables collaborative development of SQL scripts. Maintains a history of changes for
audit and rollback purposes.

6. Cross-Environment Usage Purpose: SQL files written in Notepad can be used in any
environment that supports SQL execution.
Benefits: Eliminates dependency on specific IDEs or database GUIs. Provides flexibility
to work on different machines or environments.

3. EQUIPMENT USED

The list of the essential equipment for setting up MySQL and creating a
database:

1. Computer or Server (with an OS like Windows, Linux, or macOS)


2. MySQLServer Software (e.g., MySQL, XAMPP, or WAMP)
3. Database Management Tool (e.g., MySQL Workbench or phpMyAd-
min)
4. Editor (e.g., VS Code or Notepad++)
5. Network Connection (for remote access, if applicable)

2
CHAPTER 4. PROCEDURE 3

4. PROCEDURE

Managing Databases Using Notepad: A Comprehensive Guide Manag-


ing databases often involves specialized tools or graphical user interfaces
(GUIs), such as SQL Management Studio or database-specific software.
However, in certain scenarios, a lightweight text editor like Notepad can
be used to create, edit, and manage database files. This method is par-
ticularly useful for handling plain-text formats like SQL, CSV, JSON,
or XML, offering simplicity and cross-platform compatibility. Below is
a detailed guide explaining the steps and considerations for managing
databases using Notepad.
Setting Up the Database Environment Before beginning database man-
agement with Notepad, it is essential to prepare the necessary tools and
environment:
Database Management System (DBMS): Install a DBMS such as MySQL,
PostgreSQL, or SQLite. These systems will execute the database scripts
or files created in Notepad. Ensure the DBMS is properly configured to
connect to your database instance.
Command-Line Interface (CLI): A command-line tool is essential for run-
ning database scripts created in Notepad. For example, the mysql CLI
is used for MySQL, while psql is used for PostgreSQL. These tools pro-
vide an interface to execute SQL commands or scripts directly against the
database.
Environment Setup: Verify that the system environment variables are cor-
rectly configured, so you can access the DBMS or CLI from any directory
without additional setup.
Creating and Managing SQL Files in Notepad Once the environment is
CHAPTER 4. PROCEDURE 4

ready, you can begin working with Notepad to handle your database. Here’s
how:
Writing SQL Commands: Open Notepad and start writing SQL com-
mands to define database operations. These can include creating tables,
defining relationships, inserting data, or writing complex queries. The
SQL syntax must be accurate, as Notepad does not provide syntax high-
lighting or validation tools.
Saving the File: Save your work with a .sql file extension. This ensures
that the DBMS or CLI recognizes the file as a valid SQL script. Use mean-
ingful filenames, such as created atabase.sqlorinsertd ata.sql, toorganizeyourscripts.
Executing the Script: Use the CLI associated with your DBMS to execute the
SQL file. For example, to run a MySQL script, use the command:
css Copy code mysql -u username -p databasen ame < path/to/sqlf ile.sqlReplaceusernam
Benefits of Using Notepad for Database Management Simplicity: Notepad of-
fers a distraction-free environment, allowing you to focus solely on writing and
editing SQL commands without additional features complicating the process.
Portability: SQL scripts written in Notepad can be executed on any machine
with a compatible DBMS, making them highly portable.
Compatibility: Notepad is a basic text editor available on most operating sys-
tems, ensuring cross-platform compatibility for editing SQL files.
Version Control: Plain-text SQL files can easily be integrated with version con-
trol systems like Git. This allows for collaborative script development, tracking
changes, and reverting to earlier versions when needed.
Limitations and Workarounds Notepad lacks advanced features like syntax high-
lighting, auto-completion, or error detection, which are standard in dedicated
SQL editors. To address these limitations, consider pairing Notepad with lightweight
tools like command-line linters or plugins that add basic SQL syntax checking.
Conclusion Using Notepad to manage databases provides a simple and efficient
approach for writing and executing SQL commands, particularly for users who
CHAPTER 4. PROCEDURE 5

prefer minimal tools or need to work in constrained environments. While it


lacks advanced features, Notepad’s portability, compatibility, and ease of use
make it a valuable option for handling plain-text database files. With proper
setup and understanding of the DBMS environment, Notepad can be a practical
solution for small-scale or emergency database management tasks.

4.1 Farhan.sql

– MySQL dump 10.13 Distrib 8.0.39, for Win64 (x866 4) − − − −Host :


localhostDatabase : f arhand atabase − − − − − − − − − − − − − − − − −
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
− − − − − − − − −Serverversion8.0.39
CREATE DATABASE IF NOT EXISTS demod atabasea dmission; U SEf arhand atabase;
– —————————————————— – Table structure for table ‘admissionr esult‘−
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
−−−−−−−−−−−−−−−−−−−−−−−
DROP TABLE IF EXISTS admissionr esult;
CREATE TABLE admissionr esult(Resulti dintN OT N U LLAU T OI N CREM EN T, App
– Dumping data for table ‘admissionr esult‘IN SERT IN T Oadmissionr esultV ALU ES(1
– —————————————————— – Table structure for table ‘applicantd etails‘−
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
−−−−−−−−−−−−−−−−−−−−−−−
DROP TABLE IF EXISTS applicantd etails;
CREATE TABLE applicantd etails(Studenti dintN OT N U LLAU T OI N CREM EN T, N a
– Dumping data for table ‘applicantd etails‘IN SERT IN T Oapplicantd etailsV ALU ES(1,
01−15′ ,′ M ale′ ,′ 123M ainStreet, Dhaka, Bangladesh′ ), (2,′ SamihaSultana′ ,′ rahima.
05−20′ ,′ F emale′ ,′ 456LakeRoad, Chattogram, Bangladesh′ ), (3,′ AbdulKarim′ ,′ abdul
12−10′ ,′ M ale′ ,′ 789HillStreet, Sylhet, Bangladesh′ ), (4,′ F atemaBegum′ ,′ f atema.beg
08−25′ ,′ F emale′ ,′ 101GreenAvenue, Rajshahi, Bangladesh′ ), (5,′ ShahadatHossain′ ,
CHAPTER 4. PROCEDURE 6

03−05′ ,′ M ale′ ,′ 202RiverRoad, Khulna, Bangladesh′ ), (6,′ Raisinghania′ ,′ rai@exam


02−21′ ,′ M ale′ ,′ 342Streetmuktijondddhalane′ ), (7,′ M ontu′ ,′ [email protected]
01−21′ ,′ M ale′ ,′ Banglalane, Gazipur, Dhaka, Bangladesh′ ), (8,′ M dKabirHossain′ ,′ k
04 − 21′ ,′ M ale′ ,′ 199Soyapacharailen, Dhaka′ );
– —————————————————— – Table structure for table ‘ap-
plications‘ – ——————————————————
DROP TABLE IF EXISTS applications;
CREATE TABLE applications ( Applicationi dintN OT N U LL, Studenti dintDEF AU LT N
– Dumping data for table ‘applications‘ INSERT INTO applications VALUES
(2,4,’Commerce’,’English’,’2024-12-02’,’Submitted’), (3,5,’Arts’,’Bangla’,’2024-
12-02’,’Pending’), (12345,1,’Science’,’English’,’2021-04-12’,’Rejected’), (19500,2,’Science
04-13’,’Submitted’), (19542,3,’Science’,’Bangla’,’2021-04-13’,’Pending’), (34521,7,’Comm
11-10’,’Pending’), (45672,6,’Science’,’Bangla’,’2024-12-13’,’Submitted’);
– —————————————————— – Table structure for table ‘hscd etails‘−
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
−−−−−−−−−−−−−−−−−−−−−−−
DROP TABLE IF EXISTS hscd etails;
CREATE TABLE hscd etails(SIN ointN OT N U LLAU T OI N CREM EN T, Studenti dint
– Dumping data for table ‘hscd etails‘IN SERT IN T Ohscd etailsV ALU ES(1, 1,′ N ationa
– —————————————————— – Table structure for table ‘sscd etails‘−
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
−−−−−−−−−−−−−−−−−−−−−−−
DROP TABLE IF EXISTS sscd etails;
CREATE TABLE sscd etails(SIN ointN OT N U LLAU T OI N CREM EN T, Studenti dint
– Dumping data for table ‘sscd etails‘IN SERT IN T Osscd etailsV ALU ES(2, 2,′ BlueRid
– —————————————————— – Table structure for table ‘trans-
actions‘ – ——————————————————
DROP TABLE IF EXISTS transactions;
CHAPTER 4. PROCEDURE 7

CREATE TABLE transactions ( Transactioni dintN OT N U LLAU T OI N CREM EN T, Stu


– Dumping data for table ‘transactions‘ INSERT INTO transactions VALUES
(1,1,’2024-12-01’,500.0000,’Application Fee’,’Bkash’,’Completed’), (2,2,’2024-
12-01’,1000.0000,’Admission Fee’,’credit card’,’Pending’), (3,3,’2024-12-01’,750.0000,’Ap
Fee’,’Nagad’,’Failed’), (4,4,’2024-12-01’,1500.0000,’Admission Fee’,’Bank trans-
fer’,’Completed’), (5,5,’2024-12-01’,300.0000,’Application Fee’,’Rocket’,’Completed’);
– ————————————————————– – staff details – ———
—————————————————–
DROP TABLE IF EXISTS staffd etails;
CREATE TABLE staffd etails(IDIN T P RIM ARY KEY, N ameV ARCHAR(50), Desig
– Dumping data for table ’staffd etails′ IN SERT IN T Ostaf fd etails(ID, N ame, Designa

4.2 Database before we Run the Notepad file we have Made

(a) We might observe There is only one Database named


’university_admission_358’
(b) Now we shall observe that after runnig the ’Farhan.sql’, we’ll
have another database named ’Demo_farhan’

Figure 4.1: List of Databases

01 | -- sql file running commands


02 | source F:\Database\Farhan.sql;
Figure 4.2: After running the file

–Now check the conditions of databases show databases;

Figure 4.3: Enter Caption

5. OBSERVATIONS AND DISCUSSIONS

5.1 Observations:

1. Data Accuracy and Consistency:

• The SQL scripts executed from Notepad were correctly processed by the database
system, showing accurate results for all queries.

8
CHAPTER 5. OBSERVATIONS AND DISCUSSIONS 9

• The structure of the database remained consistent across different environments


(e.g., MySQL and PostgreSQL), confirming compatibility with various database
management systems.

2. Efficiency of Automation:

• Repetitive database tasks such as data insertion and schema updates were success-
fully automated using SQL scripts, demonstrating the efficiency of SQL files stored
in Notepad.
• Time saved during the process of executing batch scripts instead of manually enter-
ing commands was substantial, reducing human error.

3. Portability and Collaboration:

• SQL scripts stored in Notepad were easily shared among team members and version-
controlled using Git, ensuring that changes were tracked and could be rolled back
if necessary.
• The use of plain-text files made collaboration easier as team members could edit
and execute scripts on any machine without requiring a specific IDE.

4. Ease of Debugging:

• Writing SQL in Notepad provided a simplified environment for debugging, as it


isolated the code from the database environment, allowing for easy edits and testing.
• Errors in SQL queries were easier to identify due to the plain-text format, without
distractions from graphical user interfaces.

Flexibility and Environment Compatibility:

• The ability to execute SQL files directly from Notepad on various systems and
through command-line tools confirmed the versatility of SQL files in different en-
vironments.
• No dependency on a specific IDE was needed, making it possible to work on
database tasks across various machines and setups.

5. Version Control:

• Tracking changes in SQL files through Git proved beneficial, allowing for collabo-
rative development and easy access to previous versions.
• Maintaining an audit trail of changes was useful for debugging and auditing pur-
poses, ensuring all modifications could be reviewed or reverted if necessary.
You can customize these observations based on the specific results of your report. Let
me know if you need more details or adjustments!

6. CONCLUSIONS

In conclusion, using SQL files stored in Notepad offers several benefits for managing databases,
including portability, automation, and ease of collaboration. The plain-text format enhances
flexibility, allowing SQL scripts to be executed across different environments without depen-
dency on specific IDEs or tools. Moreover, the ability to version control and debug scripts
simplifies the development process, reduces errors, and improves efficiency. Overall, handling
databases using Notepad is an effective and practical approach, particularly for repetitive tasks,
team collaboration, and cross-platform compatibility.

10

You might also like