Menu
Question Index
...


Write a program to create the select query for Oracle, given the entity object. The id field should be placed at the beginning and the other fields should be sorted by name.

Input (Object) Output (String)
new Student() SELECT ID, GENDER, MARKS, NAME, PERCENTAGE, SECTION FROM STUDENT;
new Employee() SELECT ID, DESIGNATION, GENDER, NAME, SALARY FROM EMPLOYEE;
new Mobile() SELECT COMPANYNAME, MEMORY, MODELNAME, PIXEL, PRICE, RESOLUTION FROM MOBILE;
new College() SELECT ADDRESS, COLLEGECODE, COLLEGENAME, NUMBEROFBRANCHES, NUMBEROFFACULTY, NUMBEROFSTUDENTS FROM COLLEGE;

class SelectQueryForOracle

{    public static void main(String s[])
    {
        College college = new College();
        String query = selectStatement(college);
        System.out.println(query);

    }


public static String selectStatement(Object entity) {
String result = null;
//Write code here to create the select query given the entity object
return result;
}

//If required write any additional methods here
}
class Student {

String name;
boolean gender;
int marks;
double percentage;
char section;
int id;
}

class Employee {

double salary;
String name;
String designation;
int id;
boolean gender;
}

class Mobile {

String companyName;
String modelName;
double price;
double memory;
float pixel;
String resolution;
}

class College {

int numberOfStudents;
int numberOfBranches;
int numberOfFaculty;
String collegeCode;
String address;
String collegeName;
}

Doubts

Problems

Topic: Other Advanced Topics In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App