160905
常用表操作
1. mysql -u root -p 回车
  输入密码
 
2. 显示数据库列表
  show databases
 
 
3. 进入某数据库
  use database database160904;是错的
  use database160904;才是正确的
 
4. 显示有哪些表
  show tables;
 
5.创建表
  create table student3(id int auto_increment primary key, user varchar(30) not null, password varchar(30) not null, createtime datetime);
 
6. 显示表结构
  show columns from student3;
  show columns from database160904.student3;
 
7. 插入记录
  insert into student3(user, password, createtime)values(
  'mr.hello', 'hlpass', '2016-09-05 15:59');
 
8. 查询
  select * from student;
  select * from student where password = 'hlpass';
 
9. 删除表
  show tables;
  drop table student4;
 160905

 160906
Mysql入门经典王雨竹 6.2节单表查询 
 
 
 
 
=========================== ========
1. 查询所有字段
  
=======================================================
2. 查询制定字段
 
=======================================================
3. 查询制定数据:用where设置条件
 
=======================================================
4. 带 IN 关键字的查询 其实是 where + in ( )/ where + not in( )
 
 
=======================================================
5. 带 between and 关键字的查询
 
 
=======================================================
6. 带 like 关键字的查询:含有两种通配符 % _ 百分号下划线
 
 
=======================================================
7. 用 is null 查询空值
   insert into 一条新记录
 
=======================================================
8. 带 and 的多条件查询
 
=======================================================
9. 带 or 的多条件查询
 
================================================
10. 使用 distinct 去除结果中的重复行,按查询列的序偶判定,完全一样才会去除
 
================================================
11. 使用 order by 对结果排序
 
================================================
12. 使用 group by 分组查询
 
 
=======================================================
13. limit 限制
  limit 可以设置2个参数,一个对应从编号几开始(第一条编号是0),一个对应条数
  比如 limit 0,2 从第一条开始一共3个,limit 2,4 从第三条开始,一共四条。
 
  160906

 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mysql常用表操作 | 单表查询的更多相关文章

  1. mysql 数据操作 单表查询 目录

    mysql 数据操作 单表查询 mysql 数据操作 单表查询 简单查询 避免重复DISTINCT mysql 数据操作 单表查询 通过四则运算查询 mysql 数据操作 单表查询 concat()函 ...

  2. mysql 数据操作 单表查询 where 约束 目录

    mysql 数据操作 单表查询 where约束 between and or mysql 数据操作 单表查询 where约束 is null in mysql 数据操作 单表查询 where约束 li ...

  3. mysql 数据操作 单表查询 group by 分组 目录

    mysql 数据操作 单表查询 group by 介绍 mysql 数据操作 单表查询 group by 聚合函数 mysql 数据操作 单表查询 group by 聚合函数 没有group by情况 ...

  4. MySQL常用的七种表类型(转)

    MySQL常用的七种表类型(转)   其实MySQL提供的表类型截至到今天已经有13种,各有各的好处,但是民间流传的常用的应该是7种,如果再细化出来,基本上就只有两种:InnoDB.MyIASM两种. ...

  5. Django基础(3)----模型层-单表操作,多表创建

    昨日内容回顾: 1. {% include '' %} 2. extend base.html: <html> ..... ..... ..... {% block content%} { ...

  6. MySQL常用权限操作

    MySQL常用权限操作 ** ubuntu mysql 8.0.21修改root密码 ** 1.查看默认安装密码: sudo cat /etc/mysql/debian.cnf 2. 登录mysql ...

  7. ActiveRecord-连接多张表之单表继承

    ActiveRecord-连接多张表之单表继承 1. 基本概念 Rails提供了两种机制,可以将复杂的面向对象模型映射为关系模型,即所谓的单表继承(single-table inheritance)和 ...

  8. mysql 数据操作 单表查询 group by 介绍

    group by 是在where 之后运行 在写单表查询语法的时候 应该把group by 写在 where 之后 执行顺序 1.先找到表 from 库.表名 2.按照where 约束条件 过滤你想要 ...

  9. MySQL常用sql语句-----数据表的查询操作

    常用的sql语句如下,应对工作足以 1.查询指定字段 select c_id,c_age,c_name from t_student; select c_id as 编号,c_name as 姓名,c ...

随机推荐

  1. hbase 简单操作

    创建一个表 hbase(main):001:0> create 'student', 'name' 0 row(s) in 14.0260 seconds => Hbase::Table ...

  2. hdu 2222 Keywords Search

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=2222 思路:裸AC自动机,直接贴代码做模板 #include<stdio.h> #includ ...

  3. 搭建LAMP环境注意事项

    一:安装mysql 5.5以上版本需要使用cmake 和 bison 并且需要安装ncurses 在安装MySQL完毕之后,需要覆盖 掉 /etc/my.cnf centos默认会有一个my.cnf文 ...

  4. Problem with "AnyConnect was not able to establish connection to the specified secure gateway."

    Cisco的VPN客户端最近报"AnyConnect was not able to establish connection to the specified secure gateway ...

  5. Error staring Tomcat Cannot connect to VM错误解决办法

    最近经常遇myEclipse以debug方式启动tomcat的错误提示如下: 直接run方式启动没有问题. 一般这个问题等一会就不再出现,如果有耐心的话,就等几分钟再启动.如果没有耐心,可以试试下面的 ...

  6. 开发板tftp下载文件

    搭建过程: 1.安装相关软件包:tftpd(服务端),tftp(客户端),xinetd sudo apt-get install tftpd tftp xinetd 2.建立配置文件(蓝色的目录是可以 ...

  7. 【iOS】UITabView/UICollectionView 全选问题

    UITabView/UICollectionView 全选问题 SkySeraph July. 30th 2016 Email:skyseraph00@163.com 更多精彩请直接访问SkySera ...

  8. ASP.Net Core 里是如何把一个普通的 Action 返回类型转换为某种 IActionResult 的

    秘密在于这个类型: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker 在它的 CreateActionResult 方法里会将相关类型 ...

  9. 使用ZwMapViewOfSection创建内存映射文件总结

    标 题: [原创]使用ZwMapViewOfSection创建内存映射文件总结 作 者: 小覃 时 间: 2012-06-15,02:28:36 链 接: http://bbs.pediy.com/s ...

  10. 查看Linux系统版本与位数

    查看系统发行版信息 查看LSB (Linux Standard Base)本身的版本信息. .el5   .el5 .el5 -bit LSB executable, Intel 80386, ver ...