数据库(linux)

层次型数据库

       树状的。1:N

网状数据库

      网状的。可以通过数学方法转换成层次数据库

关系数据库

      把关系数据库关系,转换成简单的二次模式

     DbaseIII;foxbase;Access orcle mysql   lotus  sql  orcle  mysql sqlite3  

     LAmp  linux  apache   mysql   php    tomcat    JAVA 

建立或选择数据库

        sqlite3     study.db

查看数据库

       .databases

退出数据库

        .quit 

 

创建表格

create    table    department (

INT

CHAR

TEXT

REAL

)

查看表格

       .table

查看表格结构

      .schema  comany

查所有表格结构

      .schema

删除表格

       drop table  department;

向表格插入内容

  1.       insert  into  company (.............)values(.........................)
  2.       insert  into  company  values  (..........................);

格式控制

      .head   on 

      .mode   column

查找表格内容

        select  *from   company

where子句

  1.          select * from company  where id=  7;
  2.      运算符:>  <   >=   <=   and  or   not  like    glob   exists
  3.          select *  from company   where  age  in (25,27);
  4.      年龄为25 或 27 岁的
  5.          select *  from companny  where  age  between  22  and  27;
  6.       年龄22——27
  7.           select * from  company  where  age  not  null;
  8.       年龄不能为空 
  9.           select * from   company  where  exists(select age  from company  wherer  salary  >65000);

like子语句和glob 子语句

  1.           select  * from   company  where   name  like  'P%';大小写不敏感
  2.           select   * from  company   where  glob  'P*’;

limit语句

            限制符合条件的返回量

  1.            select * from   company  where  age <30 limit 2;
  2.            select *  from  company   limit 2;
  3.           select *from   compay   limit  2  offset  2;

order  by  子句

         asc   升序    DeSc     降序

原文地址:https://www.cnblogs.com/yangshuyuan1009/p/9128127.html