Android原生SQLite常用SQL语句

Android原生SQLite常用SQL语句

创建表

CREATE TABLE student (id integer primary key autoincrement, name varchar(30), age integer)
复制代码

INSERT INTO student(name, age) VALUES("张三", 20)
复制代码

DELETE FROM student WHERE name=张三
复制代码

UPDATE student SET age=20 WHERE name=张三
复制代码

SELECT name FROM student WHERE age=20
复制代码

增加字段

ALTER TABLE student ADD COLUMN sex varchar(30)
复制代码

删除字段

ALTER TABLE student DROP COLUMN sex
复制代码

转载于:https://juejin.im/post/5ca2b79ef265da308939f883

你可能感兴趣的:(Android原生SQLite常用SQL语句)