时间:2021-07-01 10:21:17 帮助过:2人阅读
CREATE TABLE EMPLOYEE(
id INT NOT NULL auto_increment,
first_name VARCHAR(20) default NULL,
last_name VARCHAR(20) default NULL,
salary INT default NULL,
PRIMARY KEY(id)
);
此表有如下的记录:
id |
first_name | last_name | salary |
1 | Zara | Ali | 3000 |
2 | Roma | Ali | 5000 |
3 | Noha | Ali | 7000 |
Employee POJO 类:
要执行读取操作,让我们在Employee.java文件Employee类,如下所示:
public class Employee{
private int id;
private String first_name;
private String last_name;
private int salary; /* Define constructors for the Employee class. */
public Employee() {
}
public Employee(String fname, String lname, int salary) {
this.first_name = fname;
this.last_name = lname;
this.salary = salary;
} /* Here are the method definitions */
public int getId(){
return id;
}
public String getFirstName() {