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

JAVA

Java is a versatile and widely-used programming language known for its


platform independence, strong security features, and robustness. It
follows the "Write Once, Run Anywhere" principle, allowing developers
to write code on one platform and run it on any platform with a
compatible Java Virtual Machine (JVM). Java is purely object-oriented,
featuring automatic memory management through garbage collection,
which prevents memory leaks and simplifies memory management. Its
robust error handling, comprehensive standard library, and built-in
support for multithreading make it suitable for a wide range of
applications. Java has a vibrant developer community and has evolved
through various versions, introducing new features and capabilities.
This combination of portability, security, and rich ecosystem has made
Java a top choice for web and mobile development, as well as
enterprise-level software.

History of JAVA Programming


Language
Java, created by James Gosling and introduced by Sun Microsystems in
1995, has a storied history that spans over two decades. It was initially
envisioned for consumer electronics but quickly found a new role as a
versatile, platform-independent programming language for the
burgeoning World Wide Web. As "Write Once, Run Anywhere" became
its mantra, Java's applets brought interactivity to web browsers,
sparking the "browser wars." Subsequent versions like Java 2 (J2SE),
Enterprise Java (J2EE), and Mobile Java (J2ME) expanded its
capabilities, making it a preferred choice for enterprise applications
and mobile development. Java's journey also includes its open-sourcing
in 2006, acquisition by Oracle in 2010, and a modern era marked by
regular feature releases and a robust open-source ecosystem, ensuring
its continued relevance in diverse domains.
SQL
SQL, or Structured Query Language, is a specialized programming
language designed for managing relational databases. It is used to
perform a wide range of database-related tasks, including querying and
retrieving data, defining the structure of a database, inserting,
updating, and deleting data, and enforcing data integrity through
constraints. SQL allows users to filter and sort data, perform
aggregation operations, and group and summarize data. It also plays a
crucial role in maintaining data consistency and security by providing
transaction control and user access management features. SQL is
supported by various relational database management systems
(RDBMS) and is a fundamental tool for data management, making it
indispensable in applications ranging from web development to data
analysis and beyond.

History of SQL
SQL, or Structured Query Language, has a rich history dating back to
the 1970s. Its origins can be traced to the development of the
relational database model by Edgar F. Codd, who published his
groundbreaking paper in 1970. SQL itself was initially developed at
IBM by Donald D. Chamberlin and Raymond F. Boyce as a query language
for interacting with relational databases. The language was first known
as "SEQUEL" (Structured English Query Language) and later became
SQL as it was standardized. In 1979, the first commercially available
RDBMS, Oracle, introduced SQL as its query language. Over the years,
SQL evolved with various versions and standards, and it became an
ANSI (American National Standards Institute) and ISO (International
Organization for Standardization) standard in the 1980s. SQL has
continued to evolve and remains a cornerstone of modern database
management, with various RDBMS systems and extensions.
Certificate
This is to certify that the Project entitled
JAVA and SQL is a bonafide work done by Master
ANKUR JHA of Class XII Session 2023-24 in partial
fulfillment of CBSE’s AISSCE Examination 2024 and has
been carried out under my direct supervision and
guidance. This report or a similar report on the topic has
not been submitted for any other examination and does
not form any other course undergone by the candidate.

Teacher’s Signature:

Principal’s Signature:
Acknowledgment

I would like to acknowledge all those without whom this


project would not have been successful. Firstly, I would
wish to thank our Computer Science teacher Mrs. Nandni
who guided me throughout the project and gave his/her
immense support. He made us understand how to
successfully complete this project and without him, the
project would nothave been complete.
This project has been a source to learn and bring our
theoretical knowledge to the real-life world. So, I would
really acknowledge his help and guidance for this
project.
I would also like to thank my parents who have always been
therewhenever needed.
Once again, thanks to everyone for making this project
successful.

Ankur Jha
XII “A”
Sample Table - Worker
WORKER_ID FIRST_NAME LAST_NAME SALARY JOINING_DATE DEPARTMENT
001 Monika Arora 100000 2021-02-20 HR
09:00:00
002 Niharika Verma 80000 2021-06-11 Admin
09:00:00
003 Vishal Singhal 300000 2021-02-20 HR
09:00:00
004 Amitabh Singh 500000 2021-02-20 Admin
09:00:00
005 Vivek Bhati 500000 2021-06-11 Admin
09:00:00
006 Vipul Diwan 200000 2021-06-11 Account
09:00:00
007 Satish Kumar 75000 2021-01-20 Account
09:00:00
008 Geetika Chauhan 90000 2021-04-11 Admin
09:00:00

Sample Table - Bonus


WORKER_REF_ID BONUS_DATE BONUS_AMOUNT
1 2023-02-20 00:00:00 5000
2 2023-06-11 00:00:00 3000
3 2023-02-20 00:00:00 4000
1 2023-02-20 00:00:00 4500
2 2023-06-11 00:00:00 3500

Sample Table - Title


WORKER_REF_ID WORKER_TITLE AFFECTED_FROM
1 Manager 2023-02-20 00:00:00
2 Executive 2023-06-11 00:00:00
8 Executive 2023-06-11 00:00:00
5 Manager 2023-06-11 00:00:00
4 Asst. Manager 2023-06-11 00:00:00
7 Executive 2023-06-11 00:00:00
6 Lead 2023-06-11 00:00:00
3 Lead 2023-06-11 00:00:00
SQL Script to Seed Sample Data:
CREATE DATABASE ORG;
SHOW DATABASES;
USE ORG;

CREATE TABLE Worker (


WORKER_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
FIRST_NAME CHAR(25),
LAST_NAME CHAR(25),
SALARY INT(15),
JOINING_DATE DATETIME,
DEPARTMENT CHAR(25)
);

INSERT INTO Worker


(WORKER_ID, FIRST_NAME, LAST_NAME, SALARY, JOINING_DATE, DEPARTMENT) VALUES
(001, 'Monika', 'Arora', 100000, '21-02-20 09.00.00', 'HR'),
(002, 'Niharika', 'Verma', 80000, '21-06-11 09.00.00', 'Admin'),
(003, 'Vishal', 'Singhal', 300000, '21-02-20 09.00.00', 'HR'),
(004, 'Amitabh', 'Singh', 500000, '21-02-20 09.00.00', 'Admin'),
(005, 'Vivek', 'Bhati', 500000, '21-06-11 09.00.00', 'Admin'),
(006, 'Vipul', 'Diwan', 200000, '21-06-11 09.00.00', 'Account'),
(007, 'Satish', 'Kumar', 75000, '21-01-20 09.00.00', 'Account'),
(008, 'Geetika', 'Chauhan', 90000, '21-04-11 09.00.00', 'Admin');

CREATE TABLE Bonus (


WORKER_REF_ID INT,
BONUS_AMOUNT INT(10),
BONUS_DATE DATETIME,
FOREIGN KEY (WORKER_REF_ID)
REFERENCES Worker(WORKER_ID)
ON DELETE CASCADE
);

INSERT INTO Bonus


(WORKER_REF_ID, BONUS_AMOUNT, BONUS_DATE) VALUES
(001, 5000, '23-02-20'),
(002, 3000, '23-06-11'),
(003, 4000, '23-02-20'),
(001, 4500, '23-02-20'),
(002, 3500, '23-06-11');
CREATE TABLE Title (
WORKER_REF_ID INT,
WORKER_TITLE CHAR(25),
AFFECTED_FROM DATETIME,
FOREIGN KEY (WORKER_REF_ID)
REFERENCES Worker(WORKER_ID)
ON DELETE CASCADE
);

INSERT INTO Title


(WORKER_REF_ID, WORKER_TITLE, AFFECTED_FROM) VALUES
(001, 'Manager', '2023-02-20 00:00:00'),
(002, 'Executive', '2023-06-11 00:00:00'),
(008, 'Executive', '2023-06-11 00:00:00'),
(005, 'Manager', '2023-06-11 00:00:00'),
(004, 'Asst. Manager', '2023-06-11 00:00:00'),
(007, 'Executive', '2023-06-11 00:00:00'),
(006, 'Lead', '2023-06-11 00:00:00'),
(003, 'Lead', '2023-06-11 00:00:00');
SQL Query Questions:
Q-1. Write an SQL query to fetch “FIRST_NAME” from the Worker
table using the alias name <WORKER_NAME>.
Ans.
The required query is:

Select FIRST_NAME AS WORKER_NAME from Worker;

Q-2. Write an SQL query to fetch “FIRST_NAME” from the Worker


table in upper case.
Ans.
The required query is:

Select upper(FIRST_NAME) from Worker;

Q-3. Write an SQL query to fetch unique values of DEPARTMENT


from the Worker table.
Ans.
The required query is:

Select distinct DEPARTMENT from Worker;

Q-4. Write an SQL query to print the first three characters


of FIRST_NAME from the Worker table.
Ans.
The required query is:

Select substring(FIRST_NAME,1,3) from Worker;

Q-5. Write an SQL query to find the position of the alphabet (‘a’) in
the first name column ‘Amitabh’ from the Worker table.
Ans.
The required query is:

Select INSTR(FIRST_NAME, BINARY'a') from Worker where FIRST_NAME


= 'Amitabh';

You might also like