Computer Science Practical File
Topic: RDBMS Commands and Java Programs
Name: ____________________
Class: XI
Subject: Computer Science
School: ____________________
This project file explains the basic concepts of Relational Database Management System (RDBMS) and
demonstrates fundamental Java programming logic with examples and explanations.
Section 1: RDBMS (Relational Database Management
System)
A Relational Database Management System (RDBMS) is software used to store, manage, and retrieve data in the
form of tables. Data is organized into rows and columns, and relationships can be created between tables using
keys. RDBMS ensures data accuracy, security, and easy access. Popular RDBMS include MySQL, Oracle, SQL
Server, and PostgreSQL.
Advantages of RDBMS
• Reduces data redundancy
• Ensures data integrity
• Provides security using user roles
• Supports multiple users
• Easy data retrieval using SQL
Important SQL Commands
CREATE Command
Used to create a new table or database.
CREATE TABLE Students (id INT PRIMARY KEY, name VARCHAR(50), marks INT);
INSERT Command
Used to add new records into a table.
INSERT INTO Students VALUES (1, 'Rahul', 85);
SELECT Command
Used to retrieve data from a table.
SELECT * FROM Students;
UPDATE Command
Used to modify existing records.
UPDATE Students SET marks = 90 WHERE id = 1;
DELETE Command
Used to remove records from a table.
DELETE FROM Students WHERE id = 1;
Section 2: Java Programming
Java is a high-level, object-oriented programming language developed by Sun Microsystems. It is platform
independent, meaning Java programs can run on any system with Java Virtual Machine (JVM). Java is widely
used for application development, web applications, and enterprise software.
Features of Java
• Platform Independent
• Object-Oriented
• Secure
• Robust
• Multithreaded
Hello World
Explanation: Displays a simple message on the screen.
class Hello {
public static void main(String[] args) {
[Link]("Hello World");
}
}
Add Two Numbers
Explanation: Adds two integers and prints the result.
class Add {
public static void main(String[] args) {
int a=5,b=3;
[Link](a+b);
}
}
Even or Odd
Explanation: Checks whether a number is even or odd using modulus operator.
class EvenOdd {
public static void main(String[] args) {
int n=7;
if(n%2==0) [Link]("Even");
else [Link]("Odd");
}
}
Factorial
Explanation: Calculates factorial using loop.
class Factorial {
public static void main(String[] args) {
int n=5,fact=1;
for(int i=1;i<=n;i++) fact*=i;
[Link](fact);
}
}
Prime Number
Explanation: Checks if a number is prime by testing divisibility.
class Prime {
public static void main(String[] args) {
int n=7,flag=0;
for(int i=2;i<=n/2;i++)
if(n%i==0) flag=1;
[Link](flag==0?"Prime":"Not Prime");
}
}
Fibonacci
Explanation: Prints Fibonacci sequence.
class Fib {
public static void main(String[] args) {
int a=0,b=1,c;
for(int i=1;i<=5;i++){
[Link](a+" ");
c=a+b; a=b; b=c;
}
}
}
Palindrome
Explanation: Checks whether number reads same backward.
class Palindrome {
public static void main(String[] args) {
int n=121,rev=0,temp=n;
while(n!=0){ rev=rev*10+n%10; n/=10; }
[Link](temp==rev?"Palindrome":"Not");
}
}
Reverse Number
Explanation: Reverses digits of a number.
class Reverse {
public static void main(String[] args) {
int n=123,rev=0;
while(n!=0){
rev=rev*10+n%10;
n/=10;
}
[Link](rev);
}
}
Sum of Array
Explanation: Calculates sum of array elements.
class SumArray {
public static void main(String[] args) {
int arr[]={1,2,3,4},sum=0;
for(int i:arr) sum+=i;
[Link](sum);
}
}
Multiplication Table
Explanation: Prints table of a number.
class Table {
public static void main(String[] args) {
int n=5;
for(int i=1;i<=10;i++)
[Link](n*i);
}
}
Conclusion
Through this project, we learned the importance of RDBMS in managing data efficiently and the basics of SQL
commands. We also understood fundamental Java programming concepts such as loops, conditions, arrays, and
logic building. These concepts form the foundation for advanced programming and database management.