0% found this document useful (0 votes)
2 views3 pages

RDBMS and Java File

The document outlines five essential RDBMS commands for managing a 'Students' table, including CREATE, INSERT, SELECT, UPDATE, and DELETE. Additionally, it provides fifteen basic Java programs demonstrating fundamental programming concepts such as printing messages, performing arithmetic operations, and manipulating data structures. Each Java program is presented with its corresponding class structure and functionality.

Uploaded by

SIDHU RECORDS
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)
2 views3 pages

RDBMS and Java File

The document outlines five essential RDBMS commands for managing a 'Students' table, including CREATE, INSERT, SELECT, UPDATE, and DELETE. Additionally, it provides fifteen basic Java programs demonstrating fundamental programming concepts such as printing messages, performing arithmetic operations, and manipulating data structures. Each Java program is presented with its corresponding class structure and functionality.

Uploaded by

SIDHU RECORDS
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

RDBMS Commands and Java Programs

Section 1: Five Important RDBMS Commands

1. CREATE
CREATE TABLE Students (id INT PRIMARY KEY, name VARCHAR(50), marks INT);

2. INSERT
INSERT INTO Students VALUES (1, 'Rahul', 85);

3. SELECT
SELECT * FROM Students;

4. UPDATE
UPDATE Students SET marks = 90 WHERE id = 1;

5. DELETE
DELETE FROM Students WHERE id = 1;

Section 2: Fifteen Basic Java Programs

1. Hello World
class Hello {
public static void main(String[] args) {
[Link]("Hello World");
}
}

2. Add Two Numbers


class Add {
public static void main(String[] args) {
int a = 5, b = 3;
[Link](a + b);
}
}

3. Even or Odd
class EvenOdd {
public static void main(String[] args) {
int n = 7;
if(n % 2 == 0) [Link]("Even");
else [Link]("Odd");
}
}

4. Largest of Two Numbers


class Largest {
public static void main(String[] args) {
int a = 10, b = 20;
[Link]([Link](a,b));
}
}

5. Factorial
class Factorial {
public static void main(String[] args) {
int n = 5, fact = 1;
for(int i=1;i<=n;i++) fact*=i;
[Link](fact);
}
}

6. Reverse 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);
}
}

7. Check Prime
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");
}
}

8. Sum of Array
class SumArray {
public static void main(String[] args) {
int arr[]={1,2,3,4};
int sum=0;
for(int i:arr) sum+=i;
[Link](sum);
}
}

9. Fibonacci Series
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;
}
}
}

10. Palindrome Number


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");
}
}

11. Swap Two Numbers


class Swap {
public static void main(String[] args) {
int a=5,b=10;
int temp=a; a=b; b=temp;
[Link](a+" "+b);
}
}

12. Count Digits


class CountDigits {
public static void main(String[] args) {
int n=12345,count=0;
while(n!=0){ count++; n/=10; }
[Link](count);
}
}

13. Multiplication Table


class Table {
public static void main(String[] args) {
int n=5;
for(int i=1;i<=10;i++)
[Link](n*i);
}
}

14. Simple Interest


class SI {
public static void main(String[] args) {
int p=1000,r=5,t=2;
[Link]((p*r*t)/100);
}
}

15. Average of Numbers


class Avg {
public static void main(String[] args) {
int a=10,b=20,c=30;
[Link]((a+b+c)/3);
}
}

You might also like