数据库

作者: huicuihui | 来源:发表于2018-04-02 14:56 被阅读6次

    //创建表的SQL语句 primary key:主键,区分每一条数据因此开发中主键的值不能够相同。autoincrement:自增,修饰的属性在每一次增加数据的时候值都会自动加1。

    create table if not exists Students(stu_id integer primary key autoincrement, stu_name text, stu_gender text, stu_age integer)
    

    //插入一条数据

    insert into Students(stu_name, stu_gender, stu_age)values('哇哈哈','男',23)
    

    //更新某一条指定的数据

    update Students set stu_name = '田志超', stu_age = 25 where stu_id = 7
    

    //查询多有数据(属性)

    select * from Students
    

    “ * " 代表所有属性列的内容,如果其中一部分的话需要特别指明 如下的这句

    select stu_name,stu_gender from Students
    

    //查询指定的某一条数据

    select * from Students where stu_id = 1
    

    //where是条件,可以改。 删除一条数据

    delete from Students where stu_id = 3
    delete from Students where stu_id = 5 and stu_id = 18
    

    //删除整个表

    drop Table Students
    drop Database Students//删除数据库
    

    相关文章

      网友评论

          本文标题:数据库

          本文链接:https://www.haomeiwen.com/subject/ybqxhftx.html