摘要:
一.索引:索引是表的目录,在查找内容之前可以先在目录中查找索引位置,以此快速定位查询数据。对于索引,会保存在额外的文件中 1.1. 创建一个索引: mysql> create index ix_class on tb3(class_id); Query OK, 0 rows affected (0. 阅读全文
摘要:
mysql内置函数 <1>char_length(...)--计算字符串的长度 eg:select char_length('star') --4 <2>concat('star','comeup','shta')--字符串拼接 eg:select concat('star','comeup','s 阅读全文
摘要:
1.触发器:对某个表进行(增/删/改)操作的前后如果希望触发某个特定的行为时,可以使用触发器,触发器用于定制用户对表的行进行(增/删/改)前后的行为 -- 触发器-- delimiter $$-- create trigger tr_star before insert on student for 阅读全文
摘要:
#_author:来童星#date:2020/3/11#存储过程import pymysqlconn=pymysql.connect(host='127.0.0.1',user='root',passwd='123',db='db1',charset='utf8')cursor=conn.curso 阅读全文
摘要:
1.创建用户 create user 'lai'@'localhost' identified by '123';2.修改用户 rename user 'lai'@'localhost' to 'tong'@'localhost';3.删除用户 drop user 'tong'@'localhost 阅读全文
摘要:
18--查询各科成绩最高和最低分select count(course_id),max(num),min(num) from score group by course_id;19.按各科平均成绩从低到高和及格率的百分数从高到底排序select course_id,avg(num),sum(case 阅读全文
摘要:
要求:将score表,student表,class表连接起来,并且筛选出其中的sid,student_id,sname,course_id,cname,number SELECT score.sid, score.student_id, student.sname, score.course_id, 阅读全文
摘要:
<!doctype html><html><head><meta charset="utf-8"><title>company</title><style type="text/css">body,td,th { font-style: normal; font-weight: 100; font- 阅读全文
摘要:
from django.shortcuts import renderfrom app01 import models# Create your views here.#添加对象# create方式一def data_opr(req): pub=models.Publish.objects.filt 阅读全文
摘要:
ORM对象关系映射:用于实现面向对象编程语言里不同类型系统的数据中间的转换(就是用面向对象的方式去操作数据库的创建表以及增删改查等操作) 1.__str__方法:当打印对象的时候,不打印一堆内存地址(为了直观的让我们知道对象是谁)class person(): def __init__(self,n 阅读全文