0% found this document useful (0 votes)
4 views2 pages

SQL and Java Programming Examples

Uploaded by

mansi
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)
4 views2 pages

SQL and Java Programming Examples

Uploaded by

mansi
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

Q.1.

SQL QUERY
a) CREATE table BOOK (BOOKID INTEGER(6) PRIMARY KEY, SUBJECT
VARCHAR(30), BOOKPRICE TINY INTEGER);
b) INSERT INTO BOOK VALUES (1001, “MATH”, 460);
INSERT INTO BOOK VALUES (1001, “SCIENCE”, 490);
INSERT INTO BOOK VALUES (1001, “INFORMATION TECHNOLOGY”, 450);
c) SELECT * FROM BOOK WHERE BOOKID=1003;
d) DELETE FROM BOOK WHERE BOOKID=1001;
e) UPDATE BOOK SET BOOKPRICE=525 WHERE BOOKID=1002;
Q. 2.
import [Link];
public class AreaOfRectangle {
public static void main(String args[]){
int length, breadth, area;
Scanner sc = new Scanner([Link]);
[Link]("Enter the length of the rectangle ::");
length = [Link]();
[Link]("Enter the breadth of the rectangle ::");
breadth = [Link]();
area = length* breadth;
[Link]("Area of the rectangle is ::"+area);
}
}
public class AreaOfRectangle {
public static void main (String args[]) {
[Link]("Enter the length of the rectangle ::");
int length=[Link]([Link]());
[Link]("Enter the breadth of the rectangle ::");
int length=[Link]([Link]());
area = length * breadth;
[Link] (“Area of the rectangle is : : “+area);
Q. 3.
import [Link];
public class EvenOdd {
public static void main(String[] args) {
Scanner reader = new Scanner([Link]);
[Link]("Enter a number: ");
int num = [Link]();
if(num % 2 == 0)
[Link](num + " is even");
else
[Link](num + " is odd");
}
}

public class EvenOdd {


public static void main(String[] args) {
[Link]("Enter a number: ");
int num = [Link]([Link]());
if(num % 2 == 0)
[Link](num + " is even");
else
[Link](num + " is odd");
}
}

You might also like