昨日内容回顾 外键的变种三种关系: 多对一: 左表的多 对右表一 成立 左边的一 对右表多 不成立 foreign key(从表的id) refreences 主表的(id) 多对多 建立第三张表(foreign key) 一对一 foreign key+unique 单表查询: (1) where group by: 分组,通过某个字段 select age,count(1) from user group by age having avg(age)>25; having order by
数据操作 插入数据(记录): 用insert: 补充:插入查询结果: insert into 表名(字段1,字段2,...字段n) select (字段1,字段2,...字段n) where ...; 更新数据update 语法: update 表名 set 字段1=值1,字段2=值2 where condition; 删除数据delete:delete from 表名 where condition; 查询数据select: 单表查询: 语法: select distinct 字段1,字段2.
内容回顾 select distinct 字段1,字段2,... from 表名 where 分组之前的过滤条件 group by 分组条件 having 分组之后过滤条件 order by 排序字段1 asc,排序字段2 desc limit 5,5 as语法中给某个查询结果起别名的时候需要把查询语句中的分号去除 (select name,salary*12 as '年薪' from emp) as t1; # 一个字段展示用户名和年龄 select concat(name,':',age)
新健库 ,新增字段+类型+约束 设计表:外键(自增) 新建查询 建立表模型 /* 数据导入: Navicat Premium Data Transfer Source Server : localhost Source Server Type : MySQL Source Server Version : 50624 Source Host : localhost Source Database : sqlexam Target Server Type : MySQL Target Server
ldd的作用是打印可执行档依赖的共享库文件.它是glibc的一部分,由Roland McGrath和Ulrich Drepper维护:$ ldd --versionldd (GNU libc) 2.9Copyright (C) 2008 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERC