ios--低级错误--写错sqlite3的update语句

来源:互联网 发布:软件开发的税率 编辑:程序博客网 时间:2024/06/05 04:05


基本SQL语句:

    创建一个表
    create table student(ID integer primary key,name text,phone text,gender text);
    插入数据
    insert into student(name,phone,gender) values(‘kkkkk’,‘15001178518’,’男’);

    更新数据

         错误写法: update student set name = ‘kkklll’ and phone = ‘15101178513’ where ID = 1;

         正确写法:update student set name = ‘kkklll’,phone = ‘15101178513’ where ID = 1;

    删除数据

    delete from student where ID = 1;
    查询语句
    select name,phone from student where ID = 2;//查找ID为2的数据的姓名和电话
    select * from student where name like ‘%王%’;//查找姓名中带‘王’的所有人的全部信息
    select count(*) from student;//查看表中一共多少行数据
    删除表

    drop table student

0 0
原创粉丝点击