在sqlite3中创建表时出错

时间:2017-06-06 19:41:15

标签: python sqlite

我正在python3中学习sqlite3。我使用语法

在表格中添加了4列
c.execute("CREATE table raman(ATOMIC NUMBER INT, SYMBOL TEXT, ROW INT , COLUMN INT)")     

我想为他们插入值,所以我正在写

c.execute("INSERT INTO raman VALUES(1,'H',1,'1')");      

在此之后,如果我打印表格,它不显示插入的值。我正在使用此命令打印print c.execute(“SELECT * FROM SQLITE_ master type ='table'”)。fetchall()

1 个答案:

答案 0 :(得分:0)

完整(最小)序列就是这个。

public class User {

    String name;
    String id;
    int age;

    public User(String name) {
        this.name = name;
    }

    public User(String name, String id) {
        this.name = name;
        this.id = id;
    }

    public User(String id, int age) {
        this.id = id;
        this.age = age;
    }

    public User() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", id='" + id + '\'' +
                ", age=" + age +
                '}';
    }
} 

在您发出 class User { var name: String?=null var id: String?=null var age: Int = 0 constructor(name: String) { this.name = name } constructor(name: String, id: String) { this.name = name this.id = id } constructor(id: String, age: Int) { this.id = id this.age = age } constructor() {} override fun toString(): String { return "User{" + "name='" + name + '\'' + ", id='" + id + '\'' + ", age=" + age + '}' } } 之前,表格中不会出现(或者不一定会出现)这些值。